From 95fa278f30673db0e464825a8a3c77865fe33f78 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 14 Feb 2023 14:45:48 +0100 Subject: [PATCH] Don't assume VSCode internal commands in the server --- crates/rust-analyzer/src/to_proto.rs | 2 +- editors/code/src/commands.ts | 6 ++++++ editors/code/src/main.ts | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 78cd4b8e2b..7f4b7e2a32 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs @@ -1360,7 +1360,7 @@ pub(crate) mod command { pub(crate) fn trigger_parameter_hints() -> lsp_types::Command { lsp_types::Command { title: "triggerParameterHints".into(), - command: "editor.action.triggerParameterHints".into(), + command: "rust-analyzer.triggerParameterHints".into(), arguments: None, } } diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index b5b64e33e0..49a8ca4edb 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -87,6 +87,12 @@ export function shuffleCrateGraph(ctx: CtxInit): Cmd { }; } +export function triggerParameterHints(_: CtxInit): Cmd { + return async () => { + await vscode.commands.executeCommand("editor.action.triggerParameterHints"); + }; +} + export function matchingBrace(ctx: CtxInit): Cmd { return async () => { const editor = ctx.activeRustEditor; diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index dd439317c7..5987368e6e 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -186,5 +186,6 @@ function createCommands(): Record { resolveCodeAction: { enabled: commands.resolveCodeAction }, runSingle: { enabled: commands.runSingle }, showReferences: { enabled: commands.showReferences }, + triggerParameterHints: { enabled: commands.triggerParameterHints }, }; }