
Supersedes https://github.com/zed-industries/zed/pull/19166 TODO: - [x] Update basic zed paths - [x] update create_state_directory - [x] Use this with `NodeRuntime` - [x] Add server settings - [x] Add an 'open server settings command' - [x] Make sure it all works Release Notes: - Updated the actions `zed::OpenLocalSettings` and `zed::OpenLocalTasks` to `zed::OpenProjectSettings` and `zed::OpenProjectTasks`. --------- Co-authored-by: Conrad <conrad@zed.dev> Co-authored-by: Richard <richard@zed.dev>
47 lines
1.4 KiB
Rust
47 lines
1.4 KiB
Rust
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 `/cargo-workspace` slash command.
|
|
#[serde(default)]
|
|
pub cargo_workspace: CargoWorkspaceCommandSettings,
|
|
}
|
|
|
|
/// 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 `/cargo-workspace` slash command.
|
|
#[derive(Deserialize, Serialize, Debug, Default, Clone, JsonSchema)]
|
|
pub struct CargoWorkspaceCommandSettings {
|
|
/// Whether `/cargo-workspace` 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)
|
|
.chain(sources.server),
|
|
)
|
|
}
|
|
}
|