summaryrefslogtreecommitdiff
path: root/ide-autocomplete.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-03-04 16:12:41 -0500
committerpommicket <pommicket@gmail.com>2023-03-04 16:12:41 -0500
commita8ecd337a1714653710d69a9fcaea8b354ffded8 (patch)
treec76b706d4e366bc610aca7808c41f98e48da643c /ide-autocomplete.c
parented9d2be11db07ed1e31e884004ae65b14991de1a (diff)
regenerate tags if there are no completion results
(if regenerate-tags-if-not-found is enabled)
Diffstat (limited to 'ide-autocomplete.c')
-rw-r--r--ide-autocomplete.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ide-autocomplete.c b/ide-autocomplete.c
index 6d5716b..db9645c 100644
--- a/ide-autocomplete.c
+++ b/ide-autocomplete.c
@@ -384,12 +384,15 @@ void autocomplete_process_lsp_response(Ted *ted, const LSPResponse *response) {
void autocomplete_open(Ted *ted, uint32_t trigger) {
Autocomplete *ac = &ted->autocomplete;
if (ac->open) return;
- if (!ted->active_buffer) return;
TextBuffer *buffer = ted->active_buffer;
+ if (!buffer) return;
if (!buffer->path) return;
if (buffer->view_only) return;
autocomplete_clear_phantom(ac);
+ const Settings *settings = buffer_settings(buffer);
+ bool regenerated = false;
+ find_completions:
ted->cursor_error_time = 0;
ac->last_pos = (BufferPos){U32_MAX,0};
ac->cursor = 0;
@@ -399,7 +402,11 @@ void autocomplete_open(Ted *ted, uint32_t trigger) {
case 0:
if (autocomplete_using_lsp(ted)) {
ac->open = true;
- } else {
+ } else if (settings->regenerate_tags_if_not_found && !regenerated) {
+ regenerated = true;
+ tags_generate(ted, false);
+ goto find_completions;
+ } else {
autocomplete_no_suggestions(ted);
}
break;