Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code actions not working #1400

Merged
merged 3 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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