Serve selection and folding ranges over LSP

A bounded snapshot-only core (vls/features/TextStructure.hpp) builds
nested selection chains (identifier, line, enclosing blocks, document)
and foldable regions (brace blocks, comments, preprocessor pairs,
include groups) while ignoring literals. The server advertises and serves
textDocument/selectionRange with bounded positions and
textDocument/foldingRange through EditorDiagnostics; registered
vls_feature_tests cases cover both.
This commit is contained in:
faumaray committed 2026-12-05 14:41:03 +03:00
1 parent 8ca3dcbf74
commit 624c24d028
12 files changed
+601 -8

No files matched your search

+4 -4
View File
@@ -17,6 +17,7 @@ missing part.
| textDocument/signatureHelp | `vls_feature_tests`, real stdio session |
| textDocument/documentSymbol | `vls_index_tests` path query, real stdio session |
| textDocument/documentHighlight | `vls_feature_tests`, real stdio session |
| textDocument/selectionRange, foldingRange | `vls_feature_tests`, real stdio session |
| workspace/symbol | stock occurrence corpus |
| voidLanguageServer/analysisStatus, providerStatus | stdio corpora |
| Debug adapter (DAP) separately through `vls-dap` | `vls_live_tests`, `vls_dap_tests` |
@@ -27,7 +28,6 @@ missing part.
| --- | --- |
| Compiler-native completion with visibility proof | index-backed completion is explicitly incomplete |
| Overload-set signature help | only the selected occurrence's signature is available |
| textDocument/selectionRange, foldingRange | straightforward next slices |
| textDocument/codeAction, formatting | compiler-backed; needs a plan |
| textDocument/semanticTokens, inlayHint | larger
| textDocument/codeLens, executeCommand | command surface not designed |
@@ -38,6 +38,6 @@ missing part.
## Next slices
1. selectionRange and foldingRange from document snapshots.
2. codeAction quick fixes from published diagnostics.
3. Semantic tokens from stock occurrences.
1. codeAction quick fixes from published diagnostics.
2. Semantic tokens from stock occurrences.
3. Formatting and inlay hints.
+1 -1
View File
@@ -102,7 +102,7 @@ ingests occurrence facts after each analysis and the server answers
Hash.hpp definition through it. Real persistence migrations and cross-file
rename coverage remain open.
Index-backed completion (roadmap 14 first slice) is implemented: `include/vls/features/Completion.hpp`, `src/features/Completion.cpp` and registered `vls_feature_tests` cover prefix extraction, filtering with replacement ranges, label+kind deduplication, deterministic ranking and bounds. `Server.cpp` advertises `completionProvider` and answers `textDocument/completion` from the symbol index through `EditorDiagnostics::completion`; a real stdio session with the stock observer returned `fnv1a64` and `fnv1a64_update` at a real call site. Every result is marked incomplete because the index does not prove visibility. Signature help is now served from the compiler-provided occurrence signature (parameter labels and ranges, active parameter, innermost call selection) and advertised by the server. Document symbols are served from the index by path and document highlights from same-binding occurrence facts; both are advertised and were exercised over stdio with the stock observer. Compiler-native completion with visibility proof and deferred detail resolution remain open.
Index-backed completion (roadmap 14 first slice) is implemented: `include/vls/features/Completion.hpp`, `src/features/Completion.cpp` and registered `vls_feature_tests` cover prefix extraction, filtering with replacement ranges, label+kind deduplication, deterministic ranking and bounds. `Server.cpp` advertises `completionProvider` and answers `textDocument/completion` from the symbol index through `EditorDiagnostics::completion`; a real stdio session with the stock observer returned `fnv1a64` and `fnv1a64_update` at a real call site. Every result is marked incomplete because the index does not prove visibility. Signature help is now served from the compiler-provided occurrence signature (parameter labels and ranges, active parameter, innermost call selection) and advertised by the server. Document symbols are served from the index by path and document highlights from same-binding occurrence facts; both are advertised and were exercised over stdio with the stock observer. Selection and folding ranges are served from immutable document snapshots with registered bounded cores. Compiler-native completion with visibility proof and deferred detail resolution remain open.
The reflection provenance representation (roadmap 12 first slice) is
implemented as a bounded library with a registered suite: innermost-first
+19
View File
@@ -79,6 +79,25 @@ the upgraded snapshot (keeping `snapshot.prev.json`) and rewrites a legacy
about 25-30s in a Debug build (it passed VBS at ~27s); the full CMake run then
passed 18/18.
## December 5 selection and folding ranges
`include/vls/features/TextStructure.hpp` and
`src/features/TextStructure.cpp` add two bounded, snapshot-only cores:
`selection_chain` (identifier, line, enclosing brace blocks found within a
scan window, whole document) and `folding_ranges` (multi-line brace blocks,
block comments, grouped full-line comments, `#if`/`#endif` and
`#region`/`#endregion` pairs, and include groups, ignoring literals). The server
advertises `selectionRangeProvider` and `foldingRangeProvider` and serves
`textDocument/selectionRange` (bounded positions) and `textDocument/foldingRange`
through `EditorDiagnostics`. `vls_feature_tests` grew from 36 to 45 cases.
Real stdio session on `DocumentSnapshot.cpp` at line 10 column 9:
```
selectionRange chain: [(10, 9, 10, 19), (10, 0, 10, 30), (9, 48, 14, 1), (8, 42, 37, 1), (0, 0, 38, 0)]
foldingRange: 9 first: [{'endLine': 6, 'kind': 'imports', 'startLine': 0}, {'endLine': 37, 'startLine': 8}, {'endLine': 14, 'startLine': 9}]
```
All 18 native suites and all 18 CMake tests passed.
## December 5 document symbols and document highlights
`SymbolIndex::find_by_path` returns the records whose use location is in one