Display setting documentation in settings.json (#3936)

Let this screenshot of settings.json speak for itself: 

![image](https://github.com/zed-industries/zed/assets/24362066/fca60383-1788-43f9-803b-00f083394c8a)

Release Notes:
- Added code completion & on-hover documentation to Zed's settings.json
file.

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
Piotr Osiewicz 2024-01-08 19:30:18 +01:00 committed by GitHub
parent 5e401e4550
commit e4b1c76895
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 334 additions and 22 deletions

View file

@ -10,6 +10,7 @@ use gpui::{
};
use isahc::AsyncBody;
use schemars::JsonSchema;
use serde::Deserialize;
use serde_derive::Serialize;
use smol::io::AsyncReadExt;
@ -61,18 +62,27 @@ struct JsonRelease {
struct AutoUpdateSetting(bool);
/// Whether or not to automatically check for updates.
///
/// Default: true
#[derive(Clone, Default, JsonSchema, Deserialize, Serialize)]
#[serde(transparent)]
struct AutoUpdateSettingOverride(Option<bool>);
impl Settings for AutoUpdateSetting {
const KEY: Option<&'static str> = Some("auto_update");
type FileContent = Option<bool>;
type FileContent = AutoUpdateSettingOverride;
fn load(
default_value: &Option<bool>,
user_values: &[&Option<bool>],
default_value: &Self::FileContent,
user_values: &[&Self::FileContent],
_: &mut AppContext,
) -> Result<Self> {
Ok(Self(
Self::json_merge(default_value, user_values)?.ok_or_else(Self::missing_default)?,
Self::json_merge(default_value, user_values)?
.0
.ok_or_else(Self::missing_default)?,
))
}
}