summaryrefslogtreecommitdiff
path: root/autocomplete.c
diff options
context:
space:
mode:
Diffstat (limited to 'autocomplete.c')
-rw-r--r--autocomplete.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/autocomplete.c b/autocomplete.c
index 2d1574e..1421201 100644
--- a/autocomplete.c
+++ b/autocomplete.c
@@ -123,6 +123,7 @@ static void autocomplete_find_completions(Ted *ted) {
static void autocomplete_process_lsp_response(Ted *ted, const LSPResponse *response) {
Autocomplete *ac = &ted->autocomplete;
+ bool was_waiting = ac->waiting_for_lsp;
ac->waiting_for_lsp = false;
if (!ac->open) {
// user hit escape before completions arrived.
@@ -149,7 +150,9 @@ static void autocomplete_process_lsp_response(Ted *ted, const LSPResponse *respo
autocomplete_no_suggestions(ted);
return;
case 1:
- autocomplete_complete(ted, ac->completions[ac->suggested[0]]);
+ // if we just finished loading suggestions, and there's only one suggestion, use it
+ if (was_waiting)
+ autocomplete_complete(ted, ac->completions[ac->suggested[0]]);
return;
}
}