refactor(chat): move completion logic to separate module - #1267
Merged
Conversation
deathbeam
force-pushed
the
omnifunc
branch
2 times, most recently
from
August 4, 2025 00:55
75d955f to
e154aba
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the automatic chat autocompletion mechanism with Vim's omnifunc feature to provide autocompletion in a more standard way. The change eliminates the need for the chat_autocomplete configuration option and associated TextChangedI autocmd complexity.
- Removes the
chat_autocompleteconfiguration option and its associated logic - Implements a new
CopilotChatOmnifuncfunction to handle autocompletion via Vim's omnifunc - Simplifies buffer setup by removing autocmd-based completion triggers
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lua/CopilotChat/init.lua | Adds omnifunc implementation and removes TextChangedI autocmd-based autocompletion logic |
| lua/CopilotChat/config.lua | Removes the chat_autocomplete configuration option |
Comments suppressed due to low confidence (1)
lua/CopilotChat/init.lua:775
- [nitpick] The function name should follow Lua naming conventions. Consider renaming to
copilot_chat_omnifunc(snake_case) to maintain consistency with other local functions in the codebase.
function CopilotChatOmnifunc(findstart, _)
deathbeam
force-pushed
the
omnifunc
branch
3 times, most recently
from
August 8, 2025 19:24
87b9e55 to
89611d7
Compare
deathbeam
force-pushed
the
omnifunc
branch
3 times, most recently
from
August 8, 2025 19:52
21f7ed2 to
b7682f2
Compare
deathbeam
marked this pull request as ready for review
August 8, 2025 19:53
This change refactors the chat completion logic by moving it from init.lua into a new completion.lua module. It also updates mappings and setup to use the new module, improving code organization and maintainability. Autocomplete setup is now handled in the completion module, and prompt listing is extracted to a helper function. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BEGIN_COMMIT_OVERRIDE
feat(completion): add support for omnifunc and move completion logic to separate module
This change refactors the chat completion logic by moving it from
init.lua into a new completion.lua module. It also updates mappings
and setup to use the new module, improving code organization and
maintainability. Autocomplete setup is now handled in the completion
module, and prompt listing is extracted to a helper function.
Together with vim.o.autocomplete and vim.o.complete=".,o" we can achieve autocomplete in normal way as well now with just omnifunc
END_COMMIT_OVERRIDE