Skip to content

Commit 7a4d8da

Browse files
authored
Merge pull request #1400 from BetterThanTomorrow/fix_code_actions_not_working
Fix code actions not working
2 parents cebb3c6 + a522055 commit 7a4d8da

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Changes to Calva.
77
- Internal: [Handle the unknown-op status from test commands](https://github.com/BetterThanTomorrow/calva/pull/1365)
88
- Fix: [textDocument/linkedEditingRange failed when opening files or moving cursor](https://github.com/BetterThanTomorrow/calva/issues/1374)
99
- Fix: [paredit.spliceSexp doesn't work with set literals](https://github.com/BetterThanTomorrow/calva/issues/1395)
10+
- Fix: [LSP code actions not working](https://github.com/BetterThanTomorrow/calva/issues/1373)
1011

1112
## [2.0.225] - 2021-11-10
1213
- Revert 224 changes: [Version v2.0.224 causes problems on some machines (possibly Windows related)](https://github.com/BetterThanTomorrow/calva/issues/1379)

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lsp/main.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import * as path from 'path';
1212
import * as state from '../state';
1313
import { provideHover } from '../providers/hover';
1414
import { provideSignatureHelp } from '../providers/signature';
15+
import { ProviderResult, CodeAction } from 'vscode';
1516

1617
const LSP_CLIENT_KEY = 'lspClient';
1718
const RESOLVE_MACRO_AS_COMMAND = 'resolve-macro-as';
@@ -41,6 +42,14 @@ function createClient(clojureLspPath: string): LanguageClient {
4142
provideLinkedEditingRange: async (_document, _position, _token, _next): Promise<vscode.LinkedEditingRanges> => {
4243
return null;
4344
},
45+
async resolveCodeAction(item, token, next): Promise<CodeAction> {
46+
const { command } = await next(item, token);
47+
if (command) {
48+
sendCommandRequest(command.command, command.arguments);
49+
return null;
50+
}
51+
return next(item, token);
52+
},
4453
handleDiagnostics(uri, diagnostics, next) {
4554
if (uri.path.endsWith(config.REPL_FILE_EXT)) {
4655
return;

0 commit comments

Comments
 (0)