Distinguish definition tokens from declarations

The stock observer reports targetKind inside each proven target span,
the decoder carries it, and semantic tokens apply the legend's
definition modifier instead of always declaring. The observer
verifier validates the field and the definition span parser ignores it
as envelope metadata. A real stdio session showed modifier 2 on the
factory definitions.
This commit is contained in:
faumaray committed 2026-12-06 04:23:39 +03:00
1 parent 67ca5ea275
commit e4a68a3678
9 files changed
+41 -5

No files matched your search

+1
View File
@@ -13,6 +13,7 @@ namespace vls::features::semantic_tokens {
inline constexpr std::uint32_t function_type = 0;
// Bit flag in Token::modifiers, matching the server's advertised legend.
inline constexpr std::uint32_t declaration_modifier = 1;
inline constexpr std::uint32_t definition_modifier = 2;
// Second legend entry: a compiler-proven type name.
inline constexpr std::uint32_t type_type = 1;
+2
View File
@@ -24,6 +24,8 @@ struct Occurrence {
std::optional<Documents::Range> extent;
// Uid of the reported class type of this call's result, when present.
std::uint32_t result_type_uid{};
// The resolved target is a definition (not merely a declaration).
bool target_is_definition{};
[[nodiscard]] bool has_definition() const noexcept { return definition_file != nullptr; }
};