summaryrefslogtreecommitdiff
path: root/lsp-parse.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-22 23:46:17 -0500
committerpommicket <pommicket@gmail.com>2022-12-22 23:46:17 -0500
commitdaee4283b56603e172aac547c20c5534e588f60d (patch)
treea271d0f1a0754945e08f10fca2061f194b74882e /lsp-parse.c
parentb906df08a805e704e45cb7f2bc4b31e83d3222fe (diff)
finish up capabilities (for now)
Diffstat (limited to 'lsp-parse.c')
-rw-r--r--lsp-parse.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lsp-parse.c b/lsp-parse.c
index 6b4dc46..9d02782 100644
--- a/lsp-parse.c
+++ b/lsp-parse.c
@@ -171,6 +171,17 @@ static bool parse_completion(LSP *lsp, const JSON *json, LSPResponse *response)
item->text_edit.type = (LSPTextEditType)edit_type;
}
+ JSONString documentation = {0};
+ JSONValue documentation_value = json_object_get(json, item_object, "documentation");
+ // the "documentation" field is either just a string or an object containing
+ // a type ("markdown" or "plaintext") and a string.
+ if (documentation_value.type == JSON_STRING) {
+ documentation = documentation_value.val.string;
+ } else if (documentation_value.type == JSON_OBJECT) {
+ documentation = json_object_get_string(json, documentation_value.val.object,
+ "value");
+ }
+
JSONString detail_text = json_object_get_string(json, item_object, "detail");
if (detail_text.pos) {