Add check for semantic tokens client capability

This commit is contained in:
Austin Clements 2021-03-29 19:04:55 -05:00
parent bdac0899ca
commit ec7ed30e65

View File

@ -1375,7 +1375,7 @@ fn closeDocumentHandler(arena: *std.heap.ArenaAllocator, id: types.RequestId, re
} }
fn semanticTokensFullHandler(arena: *std.heap.ArenaAllocator, id: types.RequestId, req: requests.SemanticTokensFull, config: Config) (error{OutOfMemory} || std.fs.File.WriteError)!void { fn semanticTokensFullHandler(arena: *std.heap.ArenaAllocator, id: types.RequestId, req: requests.SemanticTokensFull, config: Config) (error{OutOfMemory} || std.fs.File.WriteError)!void {
if (config.enable_semantic_tokens) { if (config.enable_semantic_tokens and client_capabilities.supports_semantic_tokens) {
const handle = document_store.getHandle(req.params.textDocument.uri) orelse { const handle = document_store.getHandle(req.params.textDocument.uri) orelse {
logger.warn("Trying to get semantic tokens of non existent document {s}", .{req.params.textDocument.uri}); logger.warn("Trying to get semantic tokens of non existent document {s}", .{req.params.textDocument.uri});
return try respondGeneric(id, no_semantic_tokens_response); return try respondGeneric(id, no_semantic_tokens_response);