From 72d4d53d46abaac3236830618941d5a1e5445f71 Mon Sep 17 00:00:00 2001 From: Eric Dallo Date: Mon, 17 Jan 2022 22:02:41 -0300 Subject: [PATCH] Exclude repl from LSP analysis Fixes #1250 --- CHANGELOG.md | 2 ++ src/lsp/main.ts | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8f08dde6..c2f9de2db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ Changes to Calva. ## [Unreleased] - [Add custom commands from libraries](https://github.com/BetterThanTomorrow/calva/pull/1442) +- [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). diff --git a/src/lsp/main.ts b/src/lsp/main.ts index a08e95af2..3ba4abef5 100644 --- a/src/lsp/main.ts +++ b/src/lsp/main.ts @@ -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'; @@ -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 => { return null; },