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:
Michael Sloan
2025-01-13 02:34:35 +00:00
committed by GitHub
parent 4c50201036
commit 6aba3950d2
37 changed files with 506 additions and 283 deletions
+6 -6
View File
@@ -10,15 +10,14 @@ use editor::{
movement::{self, FindRange},
Bias, DisplayPoint, Editor,
};
use itertools::Itertools;
use gpui::{actions, impl_actions, ViewContext};
use itertools::Itertools;
use language::{BufferSnapshot, CharKind, Point, Selection, TextObject, TreeSitterOptions};
use multi_buffer::MultiBufferRow;
use schemars::JsonSchema;
use serde::Deserialize;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema)]
pub enum Object {
Word { ignore_punctuation: bool },
Sentence,
@@ -40,13 +39,14 @@ pub enum Object {
Comment,
}
#[derive(Clone, Deserialize, PartialEq)]
#[derive(Clone, Deserialize, JsonSchema, PartialEq)]
#[serde(rename_all = "camelCase")]
struct Word {
#[serde(default)]
ignore_punctuation: bool,
}
#[derive(Clone, Deserialize, PartialEq)]
#[derive(Clone, Deserialize, JsonSchema, PartialEq)]
#[serde(rename_all = "camelCase")]
struct IndentObj {
#[serde(default)]