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
|
@ -11,12 +11,12 @@ use serde::{Deserialize, Serialize};
|
|||
// https://github.com/mmastrac/rust-ctor/issues/280
|
||||
pub fn init() {}
|
||||
|
||||
#[derive(Clone, PartialEq, Deserialize)]
|
||||
#[derive(Clone, PartialEq, Deserialize, JsonSchema)]
|
||||
pub struct OpenBrowser {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Deserialize)]
|
||||
#[derive(Clone, PartialEq, Deserialize, JsonSchema)]
|
||||
pub struct OpenZedUrl {
|
||||
pub url: String,
|
||||
}
|
||||
|
@ -65,9 +65,10 @@ pub mod feedback {
|
|||
|
||||
pub mod theme_selector {
|
||||
use gpui::impl_actions;
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(PartialEq, Clone, Default, Debug, Deserialize)]
|
||||
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema)]
|
||||
pub struct Toggle {
|
||||
/// A list of theme names to filter the theme selector down to.
|
||||
pub themes_filter: Option<Vec<String>>,
|
||||
|
@ -76,20 +77,21 @@ pub mod theme_selector {
|
|||
impl_actions!(theme_selector, [Toggle]);
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Deserialize, PartialEq)]
|
||||
#[derive(Clone, Default, Deserialize, PartialEq, JsonSchema)]
|
||||
pub struct InlineAssist {
|
||||
pub prompt: Option<String>,
|
||||
}
|
||||
|
||||
impl_actions!(assistant, [InlineAssist]);
|
||||
|
||||
#[derive(PartialEq, Clone, Deserialize, Default)]
|
||||
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema)]
|
||||
pub struct OpenRecent {
|
||||
#[serde(default)]
|
||||
pub create_new_window: bool,
|
||||
}
|
||||
gpui::impl_actions!(projects, [OpenRecent]);
|
||||
gpui::actions!(projects, [OpenRemote]);
|
||||
|
||||
impl_actions!(projects, [OpenRecent]);
|
||||
actions!(projects, [OpenRemote]);
|
||||
|
||||
/// Where to spawn the task in the UI.
|
||||
#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
|
||||
|
@ -102,8 +104,8 @@ pub enum RevealTarget {
|
|||
Dock,
|
||||
}
|
||||
|
||||
/// Spawn a task with name or open tasks modal
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize)]
|
||||
/// Spawn a task with name or open tasks modal.
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, JsonSchema)]
|
||||
#[serde(untagged)]
|
||||
pub enum Spawn {
|
||||
/// Spawns a task by the name given.
|
||||
|
@ -128,8 +130,8 @@ impl Spawn {
|
|||
}
|
||||
}
|
||||
|
||||
/// Rerun last task
|
||||
#[derive(PartialEq, Clone, Deserialize, Default)]
|
||||
/// Rerun the last task.
|
||||
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema)]
|
||||
pub struct Rerun {
|
||||
/// Controls whether the task context is reevaluated prior to execution of a task.
|
||||
/// If it is not, environment variables such as ZED_COLUMN, ZED_FILE are gonna be the same as in the last execution of a task
|
||||
|
@ -147,6 +149,7 @@ pub struct Rerun {
|
|||
pub use_new_terminal: Option<bool>,
|
||||
|
||||
/// If present, rerun the task with this ID, otherwise rerun the last task.
|
||||
#[serde(skip)]
|
||||
pub task_id: Option<String>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue