From 60241a9bbd67ca4c72c783ad193002e2d67a68cd Mon Sep 17 00:00:00 2001 From: Brandon Ringe Date: Sun, 28 Nov 2021 16:24:15 -0800 Subject: [PATCH] Send LSP command request for resolved code actions Fix #1373. Update changelog. --- CHANGELOG.md | 1 + src/lsp/main.ts | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c17b114a..ef1a23716 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Changes to Calva. - Internal: [Handle the unknown-op status from test commands](https://github.com/BetterThanTomorrow/calva/pull/1365) - Fix: [textDocument/linkedEditingRange failed when opening files or moving cursor](https://github.com/BetterThanTomorrow/calva/issues/1374) - Fix: [paredit.spliceSexp doesn't work with set literals](https://github.com/BetterThanTomorrow/calva/issues/1395) +- Fix: [LSP code actions not working](https://github.com/BetterThanTomorrow/calva/issues/1373) ## [2.0.225] - 2021-11-10 - Revert 224 changes: [Version v2.0.224 causes problems on some machines (possibly Windows related)](https://github.com/BetterThanTomorrow/calva/issues/1379) diff --git a/src/lsp/main.ts b/src/lsp/main.ts index bf84d753e..d09d67fb7 100644 --- a/src/lsp/main.ts +++ b/src/lsp/main.ts @@ -42,10 +42,10 @@ function createClient(clojureLspPath: string): LanguageClient { provideLinkedEditingRange: async (_document, _position, _token, _next): Promise => { return null; }, - resolveCodeAction(item, token, next): ProviderResult { - console.log(item); - // TODO: See if next returns codeAction/resolve response and then use info from that to call lsp command - return next(item, token); + async resolveCodeAction(item, token, next): Promise { + const { command } = await next(item, token); + sendCommandRequest(command.command, command.arguments); + return null; }, handleDiagnostics(uri, diagnostics, next) { if (uri.path.endsWith(config.REPL_FILE_EXT)) {