diff options
author | pommicket <pommicket@gmail.com> | 2022-12-22 18:19:02 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-22 18:19:02 -0500 |
commit | 6205e83793eff547d404fa5bde747076a1191893 (patch) | |
tree | e6dffd5f6ac53ed43195ccec6f57918dbfd2e7dd /autocomplete.c | |
parent | 23e138019964662b4e847770eeda2bb5d3130f7a (diff) |
didClose notification, better completion
Diffstat (limited to 'autocomplete.c')
-rw-r--r-- | autocomplete.c | 5 |
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; } } |