Skip to content

Commit

Permalink
Merge pull request #1400 from BetterThanTomorrow/fix_code_actions_not…
Browse files Browse the repository at this point in the history
…_working

Fix code actions not working
  • Loading branch information
bpringe authored Nov 29, 2021
2 parents cebb3c6 + a522055 commit 7a4d8da
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/lsp/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as path from 'path';
import * as state from '../state';
import { provideHover } from '../providers/hover';
import { provideSignatureHelp } from '../providers/signature';
import { ProviderResult, CodeAction } from 'vscode';

const LSP_CLIENT_KEY = 'lspClient';
const RESOLVE_MACRO_AS_COMMAND = 'resolve-macro-as';
Expand Down Expand Up @@ -41,6 +42,14 @@ function createClient(clojureLspPath: string): LanguageClient {
provideLinkedEditingRange: async (_document, _position, _token, _next): Promise<vscode.LinkedEditingRanges> => {
return null;
},
async resolveCodeAction(item, token, next): Promise<CodeAction> {
const { command } = await next(item, token);
if (command) {
sendCommandRequest(command.command, command.arguments);
return null;
}
return next(item, token);
},
handleDiagnostics(uri, diagnostics, next) {
if (uri.path.endsWith(config.REPL_FILE_EXT)) {
return;
Expand Down

0 comments on commit 7a4d8da

Please sign in to comment.