fix(clojure): declare didChangeWatchedFiles client capability

Serena notifies language servers about files changed outside its own edit tools (a git checkout, another editor, a build step) by sending workspace/didChangeWatchedFiles from LanguageServerManager.poll_and_notify, whose docstring names this exact case: such edits are 'otherwise invisible to a warm language server, causing symbolic queries to answer from a stale index'.

ClojureLSP never declared the corresponding client capability, so clojure-lsp was not told those notifications are sent and need not treat them as a reason to invalidate its analysis. DefaultInitializeParamsBuilder does not supply a default capabilities block, so nothing filled this in on the server's behalf.

Relates to #1593, where find_symbol returned a body from a comment mentioning the symbol rather than its definition, at a position the symbol had previously occupied.
This commit is contained in:
aayushbaluni committed 2026-08-17 11:39:28 +05:30
1 parent 19f1c33bbf
commit d4dbcecaae
3 files changed
+52

No files matched your search

@@ -325,6 +325,12 @@ class ClojureLSP(SolidLanguageServer):
"workspace": {
"applyEdit": True,
"workspaceEdit": {"documentChanges": True},
# Serena notifies language servers about files changed outside its own
# edit tools (git checkout, another editor, a build step) via
# workspace/didChangeWatchedFiles; see LanguageServerManager.poll_and_notify.
# Without declaring the capability, clojure-lsp is not told the client
# sends those notifications and may keep answering from its stale analysis.
"didChangeWatchedFiles": {"dynamicRegistration": True},
"symbol": {"symbolKind": {"valueSet": list(range(1, 27))}},
"workspaceFolders": True,
},