semantic_index_settings.rs

 1use anyhow;
 2use schemars::JsonSchema;
 3use serde::{Deserialize, Serialize};
 4use settings::Settings;
 5
 6#[derive(Deserialize, Debug)]
 7pub struct SemanticIndexSettings {
 8    pub enabled: bool,
 9}
10
11/// Configuration of semantic index, an alternate search engine available in
12/// project search.
13#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
14pub struct SemanticIndexSettingsContent {
15    /// Whether or not to display the Semantic mode in project search.
16    ///
17    /// Default: true
18    pub enabled: Option<bool>,
19}
20
21impl Settings for SemanticIndexSettings {
22    const KEY: Option<&'static str> = Some("semantic_index");
23
24    type FileContent = SemanticIndexSettingsContent;
25
26    fn load(
27        default_value: &Self::FileContent,
28        user_values: &[&Self::FileContent],
29        _: &mut gpui::AppContext,
30    ) -> anyhow::Result<Self> {
31        Self::load_via_json_merge(default_value, user_values)
32    }
33}