Serve semantic tokens from stock occurrences
A bounded core normalizes occurrence tokens (sorted, deduplicated, overlap-free, capped) and delta-encodes them. EditorDiagnostics emits one function token per proven call occurrence in the owner snapshot, and the server advertises a one-type legend and serves textDocument/semanticTokens/full. Registered tests cover normalization, encoding, overlap and bounds; a real stdio session decoded the fnv1a64 callee token.
This commit is contained in:
1 parent
946b1a005e
commit
12a71ff692
12 files changed
+220
-8
No files matched your search
@@ -266,6 +266,14 @@ DispatchResult Server::handle(std::string_view body) {
|
||||
capabilities.emplace("selectionRangeProvider", Json{true});
|
||||
capabilities.emplace("foldingRangeProvider", Json{true});
|
||||
}
|
||||
if (diagnostics_ && diagnostics_->supports_occurrences())
|
||||
capabilities.emplace(
|
||||
"semanticTokensProvider",
|
||||
Json{Json::Object{
|
||||
{"legend", Json{Json::Object{
|
||||
{"tokenTypes", Json{Json::Array{Json{std::string{"function"}}}}},
|
||||
{"tokenModifiers", Json{Json::Array{}}}}}},
|
||||
{"full", Json{true}}}});
|
||||
if (diagnostics_ && diagnostics_->supports_occurrences())
|
||||
capabilities.emplace(
|
||||
"codeActionProvider",
|
||||
@@ -378,6 +386,14 @@ DispatchResult Server::handle(std::string_view body) {
|
||||
}
|
||||
return reply(id, "result", diagnostics_->selection_ranges(*uri, selected));
|
||||
}
|
||||
if (*method == "textDocument/semanticTokens/full") {
|
||||
if (!diagnostics_ || !diagnostics_->supports_occurrences())
|
||||
return error(id, -32601, "Method not found");
|
||||
const auto *uri = as_string(member(member(params, "textDocument"), "uri"));
|
||||
if (!uri || !Void::LanguageServer::Documents::client_uri_key(*uri))
|
||||
return error(id, -32602, "Expected textDocument.uri");
|
||||
return reply(id, "result", diagnostics_->semantic_tokens(*uri));
|
||||
}
|
||||
if (*method == "textDocument/codeAction") {
|
||||
if (!diagnostics_ || !diagnostics_->supports_occurrences())
|
||||
return error(id, -32601, "Method not found");
|
||||
|
||||
Reference in new issue
Block a user