Skip to content

Commit

Permalink
Merge pull request #1479 from ericdallo/exclude-repl-from-lsp
Browse files Browse the repository at this point in the history
[LSP] Exclude repl output from lsp
  • Loading branch information
bpringe authored Jan 21, 2022
2 parents 1784053 + 72d4d53 commit e44cf03
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changes to Calva.
- [Add custom commands from libraries](https://github.com/BetterThanTomorrow/calva/pull/1442)
- Workaround: [VS Code highlights characters in the output/REPL window prompt](https://github.com/BetterThanTomorrow/calva/pull/1475)

- [Exclude REPL output window from LSP analysis](https://github.com/BetterThanTomorrow/calva/issues/1250)

## [2.0.234] - 2022-01-16
- [Improve LSP startup feedback on status bar](https://github.com/BetterThanTomorrow/calva/pull/1454)
- [Fix errors in test output when fixtures throw exceptions](https://github.com/BetterThanTomorrow/calva/issues/1456).
Expand Down
20 changes: 19 additions & 1 deletion src/lsp/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as path from 'path';
import * as state from '../state';
import { provideHover } from '../providers/hover';
import { provideSignatureHelp } from '../providers/signature';
import * as cider from '../nrepl/cider'
import { isResultsDoc } from '../results-output/results-doc';

const LSP_CLIENT_KEY = 'lspClient';
const RESOLVE_MACRO_AS_COMMAND = 'resolve-macro-as';
Expand Down Expand Up @@ -64,6 +64,24 @@ function createClient(clojureLspPath: string): LanguageClient {
"keep-require-at-start?": true,
},
middleware: {
didOpen: async (document, next) => {
if (isResultsDoc(document)) {
return;
}
return next(document);
},
didSave: async (document, next) => {
if (isResultsDoc(document)) {
return;
}
return next(document);
},
didChange: async (change, next) => {
if (isResultsDoc(change.document)) {
return;
}
return next(change);
},
provideLinkedEditingRange: async (_document, _position, _token, _next): Promise<vscode.LinkedEditingRanges> => {
return null;
},
Expand Down

0 comments on commit e44cf03

Please sign in to comment.