slash_command_settings.rs

 1use anyhow::Result;
 2use gpui::App;
 3use schemars::JsonSchema;
 4use serde::{Deserialize, Serialize};
 5use settings::{Settings, SettingsKey, SettingsSources, SettingsUi};
 6
 7/// Settings for slash commands.
 8#[derive(Debug, Default, Clone)]
 9pub struct SlashCommandSettings {
10    /// Settings for the `/cargo-workspace` slash command.
11    pub cargo_workspace: CargoWorkspaceCommandSettings,
12}
13
14/// Settings for the `/cargo-workspace` slash command.
15#[derive(Debug, Default, Clone)]
16pub struct CargoWorkspaceCommandSettings {
17    /// Whether `/cargo-workspace` is enabled.
18    pub enabled: bool,
19}
20
21impl Settings for SlashCommandSettings {
22    fn from_defaults(content: &settings::SettingsContent, cx: &mut App) -> Self {
23        Self {
24            cargo_workspace: CargoWorkspaceCommandSettings {
25                enabled: content.project.slash_commands.unwrap(),
26            },
27        }
28    }
29
30    fn refine(&mut self, content: &settings::SettingsContent, cx: &mut App) {
31        todo!()
32    }
33
34    fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut Self::FileContent) {}
35}