Improve keymap json schema (#23044)
Also: * Adds `impl_internal_actions!` for deriving the `Action` trait without registering. * Removes some deserializers that immediately fail in favor of `#[serde(skip)]` on fields where they were used. This also omits them from the schema. Release Notes: - Keymap settings file now has more JSON schema information to inform `json-language-server` completions and info, particularly for actions that take input.
This commit is contained in:
parent
4c50201036
commit
6aba3950d2
37 changed files with 506 additions and 283 deletions
|
@ -61,10 +61,9 @@ use persistence::{
|
|||
SerializedWindowBounds, DB,
|
||||
};
|
||||
use postage::stream::Stream;
|
||||
use project::{
|
||||
DirectoryLister, Project, ProjectEntryId, ProjectPath, ResolvedPath, Worktree, WorktreeId,
|
||||
};
|
||||
use project::{DirectoryLister, Project, ProjectEntryId, ProjectPath, ResolvedPath, Worktree};
|
||||
use remote::{ssh_session::ConnectionIdentifier, SshClientDelegate, SshConnectionOptions};
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
use session::AppSession;
|
||||
use settings::Settings;
|
||||
|
@ -119,9 +118,6 @@ static ZED_WINDOW_POSITION: LazyLock<Option<Point<Pixels>>> = LazyLock::new(|| {
|
|||
.and_then(parse_pixel_position_env_var)
|
||||
});
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
pub struct RemoveWorktreeFromProject(pub WorktreeId);
|
||||
|
||||
actions!(assistant, [ShowConfiguration]);
|
||||
|
||||
actions!(
|
||||
|
@ -165,64 +161,64 @@ pub struct OpenPaths {
|
|||
pub paths: Vec<PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, PartialEq)]
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema)]
|
||||
pub struct ActivatePane(pub usize);
|
||||
|
||||
#[derive(Clone, Deserialize, PartialEq)]
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema)]
|
||||
pub struct ActivatePaneInDirection(pub SplitDirection);
|
||||
|
||||
#[derive(Clone, Deserialize, PartialEq)]
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema)]
|
||||
pub struct SwapPaneInDirection(pub SplitDirection);
|
||||
|
||||
#[derive(Clone, Deserialize, PartialEq)]
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema)]
|
||||
pub struct MoveItemToPane {
|
||||
pub destination: usize,
|
||||
#[serde(default = "default_true")]
|
||||
pub focus: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, PartialEq)]
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema)]
|
||||
pub struct MoveItemToPaneInDirection {
|
||||
pub direction: SplitDirection,
|
||||
#[serde(default = "default_true")]
|
||||
pub focus: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize)]
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SaveAll {
|
||||
pub save_intent: Option<SaveIntent>,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize)]
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Save {
|
||||
pub save_intent: Option<SaveIntent>,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, Default)]
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CloseAllItemsAndPanes {
|
||||
pub save_intent: Option<SaveIntent>,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, Default)]
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CloseInactiveTabsAndPanes {
|
||||
pub save_intent: Option<SaveIntent>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, PartialEq)]
|
||||
#[derive(Clone, Deserialize, PartialEq, JsonSchema)]
|
||||
pub struct SendKeystrokes(pub String);
|
||||
|
||||
#[derive(Clone, Deserialize, PartialEq, Default)]
|
||||
#[derive(Clone, Deserialize, PartialEq, Default, JsonSchema)]
|
||||
pub struct Reload {
|
||||
pub binary_path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
action_as!(project_symbols, ToggleProjectSymbols as Toggle);
|
||||
|
||||
#[derive(Default, PartialEq, Eq, Clone, serde::Deserialize)]
|
||||
#[derive(Default, PartialEq, Eq, Clone, Deserialize, JsonSchema)]
|
||||
pub struct ToggleFileFinder {
|
||||
#[serde(default)]
|
||||
pub separate_history: bool,
|
||||
|
@ -299,7 +295,7 @@ impl PartialEq for Toast {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Default, Clone, Deserialize, PartialEq, JsonSchema)]
|
||||
pub struct OpenTerminal {
|
||||
pub working_directory: PathBuf,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue