summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autocomplete.c2
-rw-r--r--lsp-parse.c11
-rw-r--r--lsp-write.c13
-rw-r--r--main.c3
4 files changed, 28 insertions, 1 deletions
diff --git a/autocomplete.c b/autocomplete.c
index f6c6ff6..67da65a 100644
--- a/autocomplete.c
+++ b/autocomplete.c
@@ -361,7 +361,7 @@ static void autocomplete_frame(Ted *ted) {
if (completion->deprecated) {
gl_geometry_rect(rect(V2(label_x, y + (char_height - border_thickness) * 0.5f),
V2((float)state.x - label_x, 1)),
- colors[COLOR_TEXT]);
+ colors[label_color]);
}
y += char_height;
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) {
diff --git a/lsp-write.c b/lsp-write.c
index 9922862..4a56543 100644
--- a/lsp-write.c
+++ b/lsp-write.c
@@ -291,7 +291,20 @@ static void write_request(LSP *lsp, LSPRequest *request) {
// completion capabilities
write_key_obj_start(o, "completionItem");
write_key_bool(o, "snippetSupport", false);
+ write_key_bool(o, "commitCharactersSupport", false);
+ write_key_arr_start(o, "documentationFormat");
+ // we dont really support markdown
+ write_arr_elem_string(o, "plaintext");
+ write_arr_end(o);
write_key_bool(o, "deprecatedSupport", true);
+ write_key_bool(o, "preselectSupport", false);
+ write_key_obj_start(o, "tagSupport");
+ write_key_arr_start(o, "valueSet");
+ // currently the only tag in the spec
+ write_arr_elem_number(o, 1);
+ write_arr_end(o);
+ write_obj_end(o);
+ write_key_bool(o, "insertReplaceSupport", false);
write_obj_end(o);
// "completion item kinds" supported by ted
// (these are the little icons displayed for function/variable/etc.)
diff --git a/main.c b/main.c
index 198609d..c86d3b1 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,7 @@
/*
@TODO:
+- show documentation
+- finish up capabilities
- trigger characters (with setting)
- only show "Loading..." if it's taking some time (prevent flash)
- LSP setting
@@ -8,6 +10,7 @@
- close completions when a non-word character is typed
- rename buffer->filename to buffer->path
- make buffer->path NULL for untitled buffers & fix resulting mess
+- run everything through valgrind ideally with leak checking
- rust-analyzer bug reports:
- bad json can give "Unexpected error: client exited without proper shutdown sequence"
- rust-analyzer should wait until cargo metadata/check is done before sending initialize response