-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add nvim-cmp integration #345
Conversation
deathbeam
commented
May 28, 2024
Any hints regarding where |
As part of copilot chat setup ideally but it doesnt rly matter when you call it as long as both plugins will get loaded at some point as all this does is registers the source and filetype to nvim-cmp so it do not requires calling setup on either copilot chat or nvim cmp beforehand. |
Got it. I added it as a part of config = function(_, opts)
require('CopilotChat').setup(opts)
require('CopilotChat.integrations.cmp').setup()
end, |
@deathbeam with the new nvim-cmp integration when you select/accept an item from the cmp list it lists / unhides the buffer. |
You should be able to add something like the following... but keep in mind it still will flash as listed for a split second and then unlist again. So maybe you can find a better way 🤷♂️ ---Executed after the item was selected.
---@param completion_item lsp.CompletionItem
---@param callback fun(completion_item: lsp.CompletionItem|nil)
function Source:execute(completion_item, callback)
callback(completion_item)
-- reset the buffer listed to false
vim.api.nvim_set_option_value('buflisted', false, { buf = 0 })
end |
Hmm thats pretty annoying. But split second is probably fine, better than it staying there. Not sure if its worth trying to find the root cause as it sounds like nvim-cmp bug, so your workaround should be good enough for now. Do you want to PR it? |
I will submit a PR. Also I have some notes that said I researched it a bit and it is an upstream thing from nvim-cmp that is outside of our control... FYI. |
@deathbeam PR submitted: #346 |