semantic_index_settings.rs

 1use anyhow;
 2use schemars::JsonSchema;
 3use serde::{Deserialize, Serialize};
 4use settings::Setting;
 5
 6#[derive(Deserialize, Debug)]
 7pub struct SemanticIndexSettings {
 8    pub enabled: bool,
 9}
10
11#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
12pub struct SemanticIndexSettingsContent {
13    pub enabled: Option<bool>,
14}
15
16impl Setting for SemanticIndexSettings {
17    const KEY: Option<&'static str> = Some("semantic_index");
18
19    type FileContent = SemanticIndexSettingsContent;
20
21    fn load(
22        default_value: &Self::FileContent,
23        user_values: &[&Self::FileContent],
24        _: &gpui::AppContext,
25    ) -> anyhow::Result<Self> {
26        Self::load_via_json_merge(default_value, user_values)
27    }
28}