-
Notifications
You must be signed in to change notification settings - Fork 9
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
Question: behavior when working with nvim-cmp
#2
Comments
Hello, thanks for feedback.
This is definitely a bug, I will fix it. |
It doesn't completely fix you issue, because plugin doesn't currently expose I have tested cmp.events and have found strange behavior with cmp.event:on("menu_closed", function()
vim.print("bye")
end) It prints |
The code snippet in my first post now works as expected. Thank you for that. However after the recent update, I get the following error whenever I leave
|
Yes, I'm aware of this (were testing you snippets too). Should be fixed now You can try this snippet to work it as you expected cmp.event:on("menu_opened", function()
vim.cmd("NeoCodeium disable")
require("neocodeium").clear()
end)
cmp.event:on("menu_closed", function()
vim.cmd("NeoCodeium enable")
require("neocodeium").cycle_or_complete()
end)
|
For completeness the configuration I'm testing is the following return {
{
"monkoose/neocodeium",
event = "VeryLazy",
config = function()
local neocodeium = require("neocodeium")
neocodeium.setup({
-- manual = true,
filetypes = {
TelescopePrompt = false,
["neo-tree-popup"] = false,
["dap-repl"] = false,
},
})
-- stylua: ignore start
vim.keymap.set("i", "<A-f>", function() neocodeium.accept() end)
vim.keymap.set("i", "<A-w>", function() neocodeium.accept_word() end)
vim.keymap.set("i", "<A-a>", function() neocodeium.accept_line() end)
vim.keymap.set("i", "<A-e>", function() neocodeium.cycle_or_complete() end)
vim.keymap.set("i", "<A-r>", function() neocodeium.cycle_or_complete(-1) end)
vim.keymap.set("i", "<A-c>", function() neocodeium.clear() end)
-- stylua: ignore end
end,
},
{
"nvim-cmp",
opts = function(_, opts)
local cmp = require("cmp")
local neocodeium = require("neocodeium")
opts.completion = {
-- autocomplete = false,
}
-- Make codeium suggestions appear only when `nvim-cmp` menu is closed
cmp.event:on("menu_opened", function()
neocodeium.clear()
end)
cmp.event:on("menu_closed", function()
neocodeium.cycle_or_complete()
end)
end,
},
} |
Wow, you're so fast!! Thank you a lot for helping me with this. Can verify the latest plugin update and the snippet you provided work as expected. Really appreciate it 😄 |
Thank you for reporting the issue. Wasn't aware of it. The plugin is still beta quality, so if you find any other issues I will be appreciated of any feedback. |
I will be using it in my testing configuration, so if I find anything else I will let you know. |
Seems like the fix was not tested well, now for me neocodeium suggestions flickers when cmp events are enabled, because of the nvim-cmp bug that invoke menu_closed way to often hrsh7th/nvim-cmp#1187 and it is stale. Will try to find a solution, but it is hard to fix something broken by desing. |
I don't see any flickering?? Here is a screencast from my testing configuration Screencast.2024-04-02.18.04.55.webm |
I did however bump into another bug maybe? When I open Telescope, i get the following
even though I have neocodeium.setup({
filetypes = {
["TelescopePrompt"] = false,
["neo-tree-popup"] = false,
["dap-repl"] = false,
},
}) |
I was able to overcome it by wrapping if utils.is_insert() then
vim.schedule(function()
nvim_exec_autocmds("CursorMovedI", { modeline = false })
end)
end in a vim.schedule function. Not sure if it's the best solution. So far, I haven't seen any other breakage by this change. Maybe something you'd like to consider. |
Should be fixed now.
It visible when you type something, that is already shown in virtual text. |
Hmmmm, I tried continuing typing without accepting suggestion, but I still don't see anything. Maybe my eyes are not good as yours 😛 |
Maybe depends on some other thing like pc spec or something else (but does codeium.vim flickering for you?). But anyway if you have checked cmp issue I linked, I don't think it is good idea to use menu_closed event. I guess I should add something like neocodeium.setup({
disable_fn = function() require("cmp").visible() end
}) But it still would not clear suggestion when menu is opened, only when you scroll it and it makes it so so solution. |
I really don't know what to tell you. For me it seems to be working perfectly as is. I'm using LazyVim distro as my config btw. Could you test it in LazyVim and see if it occurs? Maybe it's something with your configuration? Really no idea. |
In my configuration with
codeium.vim
andnvim-cmp
I have the following in thenvim-cmp
specI tried something similar with
neocodeium
with the following in the specBut seems to not be working. After playing around a bit, I noticed that even without the above code snippet, if I manually call
neocodeium.clear()
, thenneocodeium.cycle_or_complete()
does not work unless I type in a letter. On the other hand withcodeium.vim
you can callvim.fn["codeium#Complete"]()
even after you've donevim.fn["codeium#Clear"]()
without typing any letter.Is there a way to simulate the behavior achieved with
codeium.vim
withneocodeium
as well?The text was updated successfully, but these errors were encountered: