2 Commits
Author SHA1 Message Date
Dominik Jain 9f9db76622 Fix document symbol caching for language servers that post-process symbols
Caching happened in the base implementation before subclass overrides could
post-process the result, so an override's work was either never cached or,
if it mutated in place, re-applied to cached output on every hit.

Restructure both symbol caches so that they wrap the subclass logic:
subclasses now post-process via dedicated hooks (`_request_raw_document_symbols`
and `_build_document_symbols_from_raw_symbols`), and the cached value is
the fully processed result. Cache versions are bumped where the cached
content changes as a consequence.
2026-09-06 13:51:53 +02:00
Amir Fathi 19046bba66 fix(fsharp): correct selectionRange for module declarations (#925)
FsAutoComplete reports selectionRange for a `module <Name>` declaration
pointing at the `module` keyword itself, not at `<Name>`. Since
LanguageServerSymbol.line/.column (src/serena/symbol.py) build hover and
reference lookups from selectionRange.start, hovering a module returns
the LSP server's docs for the generic keyword instead of the module's
own, as reported in #925 by the F# team and confirmed by dsyme
(F# tooling) and MischaPanch in the issue thread.

This mirrors the fix already shipped for fortls in
fortran_language_server.py: a request_document_symbols override that
recovers the real identifier column by matching the declaration line
with a regex, scoped to Module symbols only since other kinds (functions,
types, open) already select correctly.

Verified with a synthetic-payload unit test (module declaration,
nested-with-equals, recursive module, an already-correct range left
untouched, and a non-Module symbol left untouched), since F# language
server tests are unconditionally disabled in this repo
(test/conftest.py: "F# language server is currently unreliable"), so no
live-FsAutoComplete regression test can run here or on CI. Confirmed the
new test fails on main (AttributeError / unfixed selectionRange) and
passes on this branch.

Fixes #925
2026-07-29 17:47:25 +02:00