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
@@ -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