From 5b1a5a250b5402bd6b220e2d9a631b293a758595 Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Sat, 20 Jul 2024 01:09:05 -0700 Subject: [PATCH] Rename rust-analyzer commands The commands `editor.action.triggerParameterHints` and `editor.action.rename` are now renamed to `rust-analyzer.triggerParameterHints` and `rust-analyzer.rename` This change helps make it clear that these commands are specific to rust-analyzer and not part of the default set of commands provided by VSCode. Fixes: https://github.com/rust-lang/rust-analyzer/issues/17644 --- crates/ide-assists/src/handlers/add_turbo_fish.rs | 2 +- crates/ide-db/src/assists.rs | 2 +- crates/ide-db/src/source_change.rs | 4 ++-- crates/rust-analyzer/src/config.rs | 4 ++-- crates/rust-analyzer/src/lsp/to_proto.rs | 2 +- editors/code/src/client.ts | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/ide-assists/src/handlers/add_turbo_fish.rs b/crates/ide-assists/src/handlers/add_turbo_fish.rs index 327709b28a..17efbcbd6c 100644 --- a/crates/ide-assists/src/handlers/add_turbo_fish.rs +++ b/crates/ide-assists/src/handlers/add_turbo_fish.rs @@ -124,7 +124,7 @@ pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext<'_>) -> Opti "Add `::<>`", ident.text_range(), |edit| { - edit.trigger_signature_help(); + edit.trigger_parameter_hints(); let new_arg_list = match turbofish_target { Either::Left(path_segment) => { diff --git a/crates/ide-db/src/assists.rs b/crates/ide-db/src/assists.rs index 0ddbde49ab..1c40685ebb 100644 --- a/crates/ide-db/src/assists.rs +++ b/crates/ide-db/src/assists.rs @@ -36,7 +36,7 @@ pub struct Assist { #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Command { /// Show the parameter hints popup. - TriggerSignatureHelp, + TriggerParameterHints, /// Rename the just inserted item. Rename, } diff --git a/crates/ide-db/src/source_change.rs b/crates/ide-db/src/source_change.rs index a85358098f..a83f8473c3 100644 --- a/crates/ide-db/src/source_change.rs +++ b/crates/ide-db/src/source_change.rs @@ -307,8 +307,8 @@ impl SourceChangeBuilder { } /// Triggers the parameter hint popup after the assist is applied - pub fn trigger_signature_help(&mut self) { - self.command = Some(Command::TriggerSignatureHelp); + pub fn trigger_parameter_hints(&mut self) { + self.command = Some(Command::TriggerParameterHints); } /// Renames the item at the cursor position after the assist is applied diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index f3ee7a98ac..4a375fc29a 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -2042,8 +2042,8 @@ impl Config { debug_single: get("rust-analyzer.debugSingle"), show_reference: get("rust-analyzer.showReferences"), goto_location: get("rust-analyzer.gotoLocation"), - trigger_parameter_hints: get("editor.action.triggerParameterHints"), - rename: get("editor.action.rename"), + trigger_parameter_hints: get("rust-analyzer.triggerParameterHints"), + rename: get("rust-analyzer.rename"), } } diff --git a/crates/rust-analyzer/src/lsp/to_proto.rs b/crates/rust-analyzer/src/lsp/to_proto.rs index cb9b141002..eb6bc2a9ce 100644 --- a/crates/rust-analyzer/src/lsp/to_proto.rs +++ b/crates/rust-analyzer/src/lsp/to_proto.rs @@ -1338,7 +1338,7 @@ pub(crate) fn code_action( let commands = snap.config.client_commands(); res.command = match assist.command { - Some(assists::Command::TriggerSignatureHelp) if commands.trigger_parameter_hints => { + Some(assists::Command::TriggerParameterHints) if commands.trigger_parameter_hints => { Some(command::trigger_parameter_hints()) } Some(assists::Command::Rename) if commands.rename => Some(command::rename()), diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 1599f4b13a..916e266cfd 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -347,8 +347,8 @@ class ExperimentalFeatures implements lc.StaticFeature { "rust-analyzer.debugSingle", "rust-analyzer.showReferences", "rust-analyzer.gotoLocation", - "editor.action.triggerParameterHints", - "editor.action.rename", + "rust-analyzer.triggerParameterHints", + "rust-analyzer.rename", ], }, ...capabilities.experimental,