forked from zed-industries/zed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…s#16186) This PR puts the availability of the `/docs` and `/project` slash commands behind their respective settings. Release Notes: - N/A
- Loading branch information
1 parent
c3edbd7
commit 4762851
Showing
5 changed files
with
91 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use anyhow::Result; | ||
use gpui::AppContext; | ||
use schemars::JsonSchema; | ||
use serde::{Deserialize, Serialize}; | ||
use settings::{Settings, SettingsSources}; | ||
|
||
/// Settings for slash commands. | ||
#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema)] | ||
pub struct SlashCommandSettings { | ||
/// Settings for the `/docs` slash command. | ||
#[serde(default)] | ||
pub docs: DocsCommandSettings, | ||
/// Settings for the `/project` slash command. | ||
#[serde(default)] | ||
pub project: ProjectCommandSettings, | ||
} | ||
|
||
/// Settings for the `/docs` slash command. | ||
#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema)] | ||
pub struct DocsCommandSettings { | ||
/// Whether `/docs` is enabled. | ||
#[serde(default)] | ||
pub enabled: bool, | ||
} | ||
|
||
/// Settings for the `/project` slash command. | ||
#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema)] | ||
pub struct ProjectCommandSettings { | ||
/// Whether `/project` is enabled. | ||
#[serde(default)] | ||
pub enabled: bool, | ||
} | ||
|
||
impl Settings for SlashCommandSettings { | ||
const KEY: Option<&'static str> = Some("slash_commands"); | ||
|
||
type FileContent = Self; | ||
|
||
fn load(sources: SettingsSources<Self::FileContent>, _cx: &mut AppContext) -> Result<Self> { | ||
SettingsSources::<Self::FileContent>::json_merge_with( | ||
[sources.default].into_iter().chain(sources.user), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters