project_diagnostics_settings.rs

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