From 1f01bcbfd50b48e6d4329b5e6162149cb1377091 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sun, 6 Dec 2026 02:14:07 +0300 Subject: [PATCH] Tokenize base-class name spans The observer's base-class references are compiler-proven name spans, so they join the type tokens alongside each class's own name. A real stdio session decoded Base at its declaration line as a type token. --- docs/agent-workflow/LSP-PARITY.md | 2 +- docs/agent-workflow/VERIFICATION.md | 11 +++++++++++ src/semantic/EditorDiagnostics.cpp | 9 +++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/agent-workflow/LSP-PARITY.md b/docs/agent-workflow/LSP-PARITY.md index 4be1e26..df2552c 100644 --- a/docs/agent-workflow/LSP-PARITY.md +++ b/docs/agent-workflow/LSP-PARITY.md @@ -41,7 +41,7 @@ missing part. Updated December 5, 2026 after semantic tokens and inlay hints. | callHierarchy / typeHierarchy | prepare, incomingCalls and outgoingCalls are implemented and served; outgoing calls are verified over stdio now that the observer reports full function extents. Type hierarchy is open. | | 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 has `function` and `type` plus a `declaration` modifier; more types/modifiers need further compiler spans | +| richer token types | legend has `function` and `type` (class, base, definition names) plus a `declaration` modifier; more types need further compiler spans | ## Next slices diff --git a/docs/agent-workflow/VERIFICATION.md b/docs/agent-workflow/VERIFICATION.md index 39f5bfd..ce4b07f 100644 --- a/docs/agent-workflow/VERIFICATION.md +++ b/docs/agent-workflow/VERIFICATION.md @@ -61,6 +61,17 @@ start coordinate only, so ranges are zero-width until an end is available. LSP adapters and index/rename/debugging integration remain open. `vbs test` passed all 17 native suites; CMake passed the reflection and trace suites. +## December 6 base-class tokens in semantic tokens + +Semantic tokens now also cover the observer-reported base-class name spans +when they lie in the open document, as `type` tokens alongside the class's own +name. Real stdio session over `Base`/`DerivedA`/`DerivedB`: +``` +semanticTokens: [(0, 7, 4, 1, 0), (1, 7, 8, 1, 0), (2, 7, 8, 1, 0), (3, 9, 6, 0, 1), ...] +``` +The first entry is `Base` at its declaration. All 18 native suites and all 18 +CMake tests passed. + ## December 6 compiler-agnostic completion source Per D-032, completion can now consume a documented, compiler-agnostic index diff --git a/src/semantic/EditorDiagnostics.cpp b/src/semantic/EditorDiagnostics.cpp index a805dd1..b431237 100644 --- a/src/semantic/EditorDiagnostics.cpp +++ b/src/semantic/EditorDiagnostics.cpp @@ -1424,6 +1424,15 @@ Json EditorDiagnostics::semantic_tokens(std::string_view uri) const { tokens.push_back({type.self.range.start.line, type.self.range.start.character, type.self.range.end.character - type.self.range.start.character, features::semantic_tokens::type_type, 0}); + for (const auto &base : type.bases) { + if (base.path != snapshot->identity.canonical_path.native() || + base.range.start.line != base.range.end.line || + base.range.end.character <= base.range.start.character) + continue; + tokens.push_back({base.range.start.line, base.range.start.character, + base.range.end.character - base.range.start.character, + features::semantic_tokens::type_type, 0}); + } } const auto normalized = features::semantic_tokens::normalize(tokens); Json::Array data;