1use anyhow::Result;
2use gpui::App;
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5use settings::{Settings, SettingsSources, SettingsUi};
6
7/// Settings for slash commands.
8#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema, SettingsUi)]
9pub struct SlashCommandSettings {
10 /// Settings for the `/cargo-workspace` slash command.
11 #[serde(default)]
12 pub cargo_workspace: CargoWorkspaceCommandSettings,
13}
14
15/// Settings for the `/cargo-workspace` slash command.
16#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema)]
17pub struct CargoWorkspaceCommandSettings {
18 /// Whether `/cargo-workspace` is enabled.
19 #[serde(default)]
20 pub enabled: bool,
21}
22
23impl Settings for SlashCommandSettings {
24 const KEY: Option<&'static str> = Some("slash_commands");
25
26 type FileContent = Self;
27
28 fn load(sources: SettingsSources<Self::FileContent>, _cx: &mut App) -> Result<Self> {
29 SettingsSources::<Self::FileContent>::json_merge_with(
30 [sources.default]
31 .into_iter()
32 .chain(sources.user)
33 .chain(sources.server),
34 )
35 }
36
37 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut Self::FileContent) {}
38}