From be7b22b0dcb5d6dabdb8d35c4641c1883c53f524 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Sun, 14 Sep 2025 13:38:48 -0600 Subject: [PATCH] Show docs for all documented actions in `keymap.json` (#38156) Release Notes: - Fixed a bug where action documentation while editing `keymap.json` was only shown for actions that take input. --- crates/settings/src/keymap_file.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/settings/src/keymap_file.rs b/crates/settings/src/keymap_file.rs index c52040f38b0544cdce4ece7bd8afdaa9bfdf4fbc..6e9ab5c34d5749e3cdaf0f144930353f2323f17b 100644 --- a/crates/settings/src/keymap_file.rs +++ b/crates/settings/src/keymap_file.rs @@ -434,11 +434,13 @@ impl KeymapFile { let mut generator = Self::action_schema_generator(); let action_schemas = cx.action_schemas(&mut generator); + let action_documentation = cx.action_documentation(); let deprecations = cx.deprecated_actions_to_preferred_actions(); let deprecation_messages = cx.action_deprecation_messages(); KeymapFile::generate_json_schema( generator, action_schemas, + action_documentation, deprecations, deprecation_messages, ) @@ -447,6 +449,7 @@ impl KeymapFile { fn generate_json_schema( mut generator: schemars::SchemaGenerator, action_schemas: Vec<(&'static str, Option)>, + action_documentation: &HashMap<&'static str, &'static str>, deprecations: &HashMap<&'static str, &'static str>, deprecation_messages: &HashMap<&'static str, &'static str>, ) -> serde_json::Value { @@ -499,14 +502,6 @@ impl KeymapFile { let mut empty_schema_action_names = vec![]; for (name, action_schema) in action_schemas.into_iter() { - let description = action_schema.as_ref().and_then(|schema| { - schema - .as_object() - .and_then(|obj| obj.get("description")) - .and_then(|v| v.as_str()) - .map(|s| s.to_string()) - }); - let deprecation = if name == NoAction.name() { Some("null") } else { @@ -523,6 +518,7 @@ impl KeymapFile { } else if let Some(new_name) = deprecation { add_deprecation_preferred_name(&mut plain_action, new_name); } + let description = action_documentation.get(name); if let Some(description) = &description { add_description(&mut plain_action, description); }