From c0397f1f4c80e73a2e4ccd1946703fe6a5bb405e Mon Sep 17 00:00:00 2001 From: pommicket Date: Tue, 3 Jan 2023 18:01:04 -0500 Subject: go to type definition --- lsp-parse.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'lsp-parse.c') diff --git a/lsp-parse.c b/lsp-parse.c index 9c22fe4..42f2291 100644 --- a/lsp-parse.c +++ b/lsp-parse.c @@ -151,23 +151,34 @@ static void parse_capabilities(LSP *lsp, const JSON *json, JSONObject capabiliti arr_add(lsp->signature_help_retrigger_chars, '>'); } - // check for hover support + // check for textDocument/hover support JSONValue hover_value = json_object_get(json, capabilities, "hoverProvider"); if (hover_value.type != JSON_UNDEFINED && hover_value.type != JSON_FALSE) { cap->hover_support = true; } - // check for definition support + // check for textDocument/definition support JSONValue definition_value = json_object_get(json, capabilities, "definitionProvider"); if (definition_value.type != JSON_UNDEFINED && definition_value.type != JSON_FALSE) { cap->definition_support = true; } - // check for declaration support + // check for textDocument/declaration support JSONValue declaration_value = json_object_get(json, capabilities, "declarationProvider"); if (declaration_value.type != JSON_UNDEFINED && declaration_value.type != JSON_FALSE) { cap->declaration_support = true; } + // check for textDocument/typeDefinition support + JSONValue type_definition_value = json_object_get(json, capabilities, "typeDefinitionProvider"); + if (type_definition_value.type != JSON_UNDEFINED && type_definition_value.type != JSON_FALSE) { + cap->type_definition_support = true; + } + + // check for textDocument/implementation support + JSONValue implementation_value = json_object_get(json, capabilities, "implementationProvider"); + if (implementation_value.type != JSON_UNDEFINED && implementation_value.type != JSON_FALSE) { + cap->implementation_support = true; + } // check for textDocument/documentHighlight support JSONValue highlight_value = json_object_get(json, capabilities, "documentHighlightProvider"); @@ -890,6 +901,8 @@ void process_message(LSP *lsp, JSON *json) { break; case LSP_REQUEST_DEFINITION: case LSP_REQUEST_DECLARATION: + case LSP_REQUEST_TYPE_DEFINITION: + case LSP_REQUEST_IMPLEMENTATION: add_to_messages = parse_definition(lsp, json, &response); break; case LSP_REQUEST_HIGHLIGHT: -- cgit v1.2.3