summaryrefslogtreecommitdiff
path: root/autocomplete.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-22 22:56:18 -0500
committerpommicket <pommicket@gmail.com>2022-12-22 22:56:18 -0500
commitb9ac4215ef8d02ad6da257315891c408bc395165 (patch)
tree3b7297102da65890944989f730dd1217c6931f7c /autocomplete.c
parent266af5ed551765ca22cb90819f570ff9371e279b (diff)
start capabilities
Diffstat (limited to 'autocomplete.c')
-rw-r--r--autocomplete.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/autocomplete.c b/autocomplete.c
index db7a045..514c9a5 100644
--- a/autocomplete.c
+++ b/autocomplete.c
@@ -138,9 +138,11 @@ static void autocomplete_process_lsp_response(Ted *ted, const LSPResponse *respo
for (size_t i = 0; i < ncompletions; ++i) {
const LSPCompletionItem *lsp_completion = &completion->items[i];
Autocompletion *ted_completion = &ac->completions[i];
- // @TODO: deal with fancier textEdits
ted_completion->label = str_dup(lsp_response_string(response, lsp_completion->label));
ted_completion->filter = str_dup(lsp_response_string(response, lsp_completion->filter_text));
+ // NOTE: here we don't deal with snippets.
+ // right now we are sending "snippetSupport: false" in the capabilities,
+ // so this should be okay.
ted_completion->text = str_dup(lsp_response_string(response, lsp_completion->text_edit.new_text));
const char *detail = lsp_response_string(response, lsp_completion->detail);
ted_completion->detail = *detail ? str_dup(detail) : NULL;
@@ -265,14 +267,14 @@ static void autocomplete_frame(Ted *ted) {
if (cursor_entry < ncompletions) {
// highlight moused over entry
Rect r = rect(V2(x, start_y + cursor_entry * char_height), V2(menu_width, char_height));
- gl_geometry_rect(r, colors[COLOR_MENU_HL]);
+ gl_geometry_rect(r, colors[COLOR_AUTOCOMPLETE_HL]);
ted->cursor = ted->cursor_hand;
}
if (!ac->waiting_for_lsp) {
// highlight cursor entry
Rect r = rect(V2(x, start_y + (float)ac->cursor * char_height), V2(menu_width, char_height));
- gl_geometry_rect(r, colors[COLOR_MENU_HL]);
+ gl_geometry_rect(r, colors[COLOR_AUTOCOMPLETE_HL]);
}
for (uint i = 0; i < ted->nmouse_clicks[SDL_BUTTON_LEFT]; ++i) {