Serve formatting through clang-format
Per the user's decision, textDocument/formatting runs clang-format as a bounded child process with a 5s deadline and capped streams. A bounded core builds the arguments (workspace .clang-format when present, otherwise the LSP tab options as an explicit LLVM style) and the whole-document edit, refusing output over 32 MiB. Registered feature tests cover the arguments, bounds and edit shape; a real stdio session formatted a misindented document. clang-format becomes a runtime dependency of formatting.
This commit is contained in:
1 parent
7acbfc4029
commit
3344a9f170
12 files changed
+247
-5
No files matched your search
@@ -25,6 +25,7 @@ missing part. Updated December 5, 2026 after semantic tokens and inlay hints.
|
||||
| textDocument/codeLens + workspace/executeCommand (`vls.showReferences`) | `vls_feature_tests`, real stdio session |
|
||||
| workspace/symbol | stock occurrence corpus |
|
||||
| textDocument/documentLink (quoted includes) | `vls_feature_tests`, real stdio session |
|
||||
| textDocument/formatting (clang-format) | `vls_feature_tests`, real stdio session |
|
||||
| workspace fileOperations (didCreate/didRename/didDelete) | `vls_feature_tests`, real stdio session |
|
||||
| workspace/willRenameFiles (include updates) | `vls_feature_tests`, real stdio session |
|
||||
| voidLanguageServer/analysisStatus, providerStatus | stdio corpora |
|
||||
@@ -41,7 +42,6 @@ missing part. Updated December 5, 2026 after semantic tokens and inlay hints.
|
||||
| Client-side application of server-issued workspace edits | rename and code actions return edits the clients apply directly |
|
||||
| Applying multi-file renames through client buffers | plans can be ready; application is client work |
|
||||
| richer token types | legend is one type (`function`) plus a `declaration` modifier; type tokens need compiler-provided spans |
|
||||
| textDocument/formatting | no formatter is available; needs a dependency decision |
|
||||
|
||||
## Next slices
|
||||
|
||||
|
||||
@@ -103,7 +103,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. Selection and folding ranges are served from immutable document snapshots with registered bounded cores. Code actions now offer the compiler's own suggested fixes (quickfix) from retained published diagnostics, with SARIF fix decoding bound to the owner snapshot. Semantic tokens encode the proven call occurrences and same-file definition names, the latter with a declaration modifier, under a bounded legend. Inlay hints project parameter types from the occurrence signature at each argument start. Workspace file-operation notifications invalidate dependent index contexts and re-queue open documents. A will-rename request returns the include updates for open documents. Reflection hover is served from a recorded snapshot file selected at launch, with the client position converted through the document snapshot. Document links resolve quoted includes to existing files without the compiler. Code lenses show index reference counts and the `vls.showReferences` command resolves them to navigation locations. Call hierarchy serves prepare and incoming calls (grouped by enclosing definition or explicitly by file) from the stock call facts. Outgoing calls are served and verified: the stock observer now reports full function extents, so nested calls are attributed to the enclosing definition. 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. Code actions now offer the compiler's own suggested fixes (quickfix) from retained published diagnostics, with SARIF fix decoding bound to the owner snapshot. Semantic tokens encode the proven call occurrences and same-file definition names, the latter with a declaration modifier, under a bounded legend. Inlay hints project parameter types from the occurrence signature at each argument start. Workspace file-operation notifications invalidate dependent index contexts and re-queue open documents. A will-rename request returns the include updates for open documents. Formatting is served through clang-format with the workspace style or the LSP options, bounded as a child process. Reflection hover is served from a recorded snapshot file selected at launch, with the client position converted through the document snapshot. Document links resolve quoted includes to existing files without the compiler. Code lenses show index reference counts and the `vls.showReferences` command resolves them to navigation locations. Call hierarchy serves prepare and incoming calls (grouped by enclosing definition or explicitly by file) from the stock call facts. Outgoing calls are served and verified: the stock observer now reports full function extents, so nested calls are attributed to the enclosing definition. 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
|
||||
|
||||
@@ -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 formatting through clang-format
|
||||
|
||||
Per the user's decision, `textDocument/formatting` runs clang-format as a
|
||||
bounded child process (5s deadline, capped stdin/stdout/stderr and line size,
|
||||
failure returns null) from `EditorDiagnostics::format`. A bounded core
|
||||
(`vls/features/Formatting.hpp`) builds the arguments and the whole-document
|
||||
edit: the workspace `.clang-format` is used when present, otherwise the LSP
|
||||
`tabSize`/`insertSpaces` become an explicit LLVM-based style (clang-format's
|
||||
`--fallback-style` accepts only named styles). The server advertises
|
||||
`documentFormattingProvider`, and output over 32 MiB is refused.
|
||||
|
||||
Real stdio session on `int x=1;\nint f( int a,int b ){return a+b;}\n`:
|
||||
```
|
||||
result: [{"newText": "int x = 1;\nint f(int a, int b) { return a + b; }\n",
|
||||
"range": {"start": {"line": 0, "character": 0}, "end": {"line": 2, "character": 0}}}]
|
||||
```
|
||||
Registered `vls_feature_tests` grew to 101 cases. All 18 native suites and all
|
||||
18 CMake tests passed. clang-format is now a runtime dependency of formatting.
|
||||
|
||||
## December 5 reflection hover from a recorded snapshot
|
||||
|
||||
Per the user's decision, `EditorDiagnostics` reflection data now comes from a
|
||||
|
||||
Reference in new issue
Block a user