project_diagnostics_settings.rs

 1use schemars::JsonSchema;
 2use serde::{Deserialize, Serialize};
 3
 4#[derive(Deserialize, Debug)]
 5pub struct ProjectDiagnosticsSettings {
 6    pub include_warnings: bool,
 7}
 8
 9/// Diagnostics configuration.
10#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
11pub struct ProjectDiagnosticsSettingsContent {
12    /// Whether to show warnings or not by default.
13    ///
14    /// Default: true
15    include_warnings: Option<bool>,
16}
17
18impl settings::Settings for ProjectDiagnosticsSettings {
19    const KEY: Option<&'static str> = Some("diagnostics");
20    type FileContent = ProjectDiagnosticsSettingsContent;
21
22    fn load(
23        default_value: &Self::FileContent,
24        user_values: &[&Self::FileContent],
25        _cx: &mut gpui::AppContext,
26    ) -> anyhow::Result<Self>
27    where
28        Self: Sized,
29    {
30        Self::load_via_json_merge(default_value, user_values)
31    }
32}