Offer compiler quick fixes as code actions
Decode GCC SARIF fixes into bounded diagnostic edits through the same physical-origin policy as locations; unprovable regions are dropped. A bounded projection filters fixes to the requested range, deduplicates and bounds them, and textDocument/codeAction serves them from retained published diagnostics. Registered tests cover the SARIF binding and the projection; a real stdio session returned the compiler's Replace 'valu' with 'value' quickfix.
This commit is contained in:
1 parent
624c24d028
commit
946b1a005e
15 files changed
+418
-10
No files matched your search
@@ -79,6 +79,28 @@ 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 code actions from compiler fixes
|
||||
|
||||
GCC's SARIF `fixes` are now decoded: `CompilerDiagnostic::fixes` carries a
|
||||
bounded description plus edits whose deleted regions are converted through the
|
||||
same physical-origin policy and owner-snapshot coordinates as locations. A fix
|
||||
for another artifact, an unprovable region or an unbound snapshot is dropped,
|
||||
never guessed. `include/vls/features/CodeActions.hpp` filters fixes to those
|
||||
intersecting the requested range, deduplicates and bounds them, and
|
||||
`EditorDiagnostics::code_actions` serves `textDocument/codeAction` (advertised
|
||||
with `codeActionKinds: ["quickfix"]`) from the retained published diagnostics.
|
||||
|
||||
A real stdio session with the stock observer on `int main() { return valu; }`:
|
||||
```
|
||||
codeAction: 1
|
||||
title: Replace 'valu' with 'value'
|
||||
kind: quickfix preferred: True
|
||||
edit: {"changes": {"file:///.../main.cpp": [{"newText": "value", "range": {"end": {"character": 24, "line": 1}, "start": {"character": 20, "line": 1}}}]}}
|
||||
```
|
||||
Registered cases cover the SARIF fix binding and the action projection;
|
||||
`vls_diagnostic_tests` and `vls_feature_tests` passed, as did all 18 native
|
||||
suites and all 18 CMake tests.
|
||||
|
||||
## December 5 selection and folding ranges
|
||||
|
||||
`include/vls/features/TextStructure.hpp` and
|
||||
|
||||
Reference in new issue
Block a user