diff options
author | pommicket <pommicket@gmail.com> | 2023-03-04 16:12:41 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-03-04 16:12:41 -0500 |
commit | a8ecd337a1714653710d69a9fcaea8b354ffded8 (patch) | |
tree | c76b706d4e366bc610aca7808c41f98e48da643c | |
parent | ed9d2be11db07ed1e31e884004ae65b14991de1a (diff) |
regenerate tags if there are no completion results
(if regenerate-tags-if-not-found is enabled)
-rw-r--r-- | ide-autocomplete.c | 11 | ||||
-rw-r--r-- | main.c | 1 |
2 files changed, 9 insertions, 3 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; @@ -5,7 +5,6 @@ FUTURE FEATURES: - better undo chaining (dechain on backspace?) - auto-reload config even for %included files - manual.md -- regenerate tags for completion too if there are no results - font setting & support for multiple fonts to cover more characters - support for variable-width fonts - robust find (results shouldn't move around when you type things) |