From 57c015b9c87312ae3cc3624e707b86e89618fbfd Mon Sep 17 00:00:00 2001 From: pommicket Date: Sat, 7 Jan 2023 11:57:07 -0500 Subject: oops turns out Hover.range is optional --- ide-autocomplete.c | 2 +- lsp-parse.c | 3 ++- main.c | 5 +---- test/lsp/JavaA/Main.java | 3 +++ 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ide-autocomplete.c b/ide-autocomplete.c index 9420387..728a54b 100644 --- a/ide-autocomplete.c +++ b/ide-autocomplete.c @@ -460,8 +460,8 @@ void autocomplete_frame(Ted *ted) { const char *completion = ac->phantom + strlen(word_at_cursor); if (*completion) { vec2 pos = buffer_pos_to_pixels(buffer, buffer->cursor_pos); - vec2 size = text_get_size_vec2(font, completion); #if 0 + vec2 size = text_get_size_vec2(font, completion); // this makes the text below the phantom less visible. // doesn't look very good, so I'm not doing it. Rect r = rect(pos, size); diff --git a/lsp-parse.c b/lsp-parse.c index 8c914fa..56a980d 100644 --- a/lsp-parse.c +++ b/lsp-parse.c @@ -495,7 +495,8 @@ static bool parse_hover(LSP *lsp, const JSON *json, LSPResponse *response) { JSONObject result = json_force_object(result_value); JSONValue range = json_object_get(json, result, "range"); - parse_range(lsp, json, range, &hover->range); + if (range.type != JSON_UNDEFINED) + parse_range(lsp, json, range, &hover->range); JSONValue contents = json_object_get(json, result, "contents"); diff --git a/main.c b/main.c index ba9c5e2..ff62481 100644 --- a/main.c +++ b/main.c @@ -1,17 +1,14 @@ /* @TODO: -- when searching files, put exact matches at the top -- TESTING: make rust-analyzer-slow (waits 10s before sending response) - TESTING: check all IDE features with different servers - run everything through valgrind ideally with leak checking -- grep -i -n TODO *.[ch] - some way of opening + closing all C files in directory for clangd textDocument/references to work? - maybe it can be done with the clangd config instead. - does vscode have the same problem? - rust-analyzer bug reports: - bad json can give "Unexpected error: client exited without proper shutdown sequence" - - containerName not always given in textDocument/references + - containerName not always given in workspace/symbols - clangd bug report: - textDocumemt/definition on ted.h declarations just gives you the declaration FUTURE FEATURES: diff --git a/test/lsp/JavaA/Main.java b/test/lsp/JavaA/Main.java index 274ba52..0ad0ae9 100644 --- a/test/lsp/JavaA/Main.java +++ b/test/lsp/JavaA/Main.java @@ -4,6 +4,9 @@ public class Main { x++; for (int i = 0; i < args.length; ++i) { String.valueOf(3.5); + String.valueOf(22); + String s = "abacada"; + s.subSequence(4, 5); } } } -- cgit v1.2.3