summaryrefslogtreecommitdiff
path: root/lsp-parse.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-01-07 12:42:34 -0500
committerpommicket <pommicket@gmail.com>2023-01-07 12:42:34 -0500
commite2aad67eedd07cff24a51faf31b8c6984a23d777 (patch)
treec0fe2e10f1a797e66ccbbe92eb9e1b6527847997 /lsp-parse.c
parent3a5d0834854b88d6139b96e93c84f9156fb63b33 (diff)
fix texlab go-to-definition
actually its their fault for ignoring the lack of capability
Diffstat (limited to 'lsp-parse.c')
-rw-r--r--lsp-parse.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lsp-parse.c b/lsp-parse.c
index 56a980d..f794c4b 100644
--- a/lsp-parse.c
+++ b/lsp-parse.c
@@ -540,15 +540,21 @@ static bool parse_hover(LSP *lsp, const JSON *json, LSPResponse *response) {
return true;
}
-// parse a Location: {uri: DocumentUri, range: Range}
+// parse a Location or a LocationLink
static bool parse_location(LSP *lsp, const JSON *json, JSONValue value, LSPLocation *location) {
if (!lsp_expect_object(lsp, value, "Location"))
return false;
JSONObject object = value.val.object;
JSONValue uri = json_object_get(json, object, "uri");
+ JSONValue range = json_object_get(json, object, "range");
+ if (uri.type == JSON_UNDEFINED) {
+ // maybe it's a LocationLink
+ uri = json_object_get(json, object, "targetUri");
+ range = json_object_get(json, object, "targetRange");
+ }
+
if (!parse_document_uri(lsp, json, uri, &location->document))
return false;
- JSONValue range = json_object_get(json, object, "range");
if (!parse_range(lsp, json, range, &location->range))
return false;
return true;