-
How do I know if suggestion is show or not using neocodeium api ? I often map multiple functions into single keymap so I want an api to check condition. My config below is working but a bit hacky I think local codeium = require("neocodeium")
vim.keymap.set("i", "<M-l>", function()
if require("neocodeium.completer"):valid() then
codeium.accept()
else
return "<Right>"
end
end, { expr = true, silent = true }) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hello. local codeium = require("neocodeium")
vim.keymap.set("i", "<M-l>", function()
local ns = vim.api.nvim_get_namespaces().neocodeium_compl
local extmarks = vim.api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
if #extmarks > 0 then
codeium.accept()
else
return "<Right>"
end
end, { expr = true, silent = true }) |
Beta Was this translation helpful? Give feedback.
-
On second thought I guess |
Beta Was this translation helpful? Give feedback.
-
@hieulw I have added new api function |
Beta Was this translation helpful? Give feedback.
@hieulw I have added new api function
requre("neocodeium").visible()
you can use it instead ofcompleter:valid()
.Internally it is just wrapper of
completer:valid()
(After some tests I have concluded that valid is perfectly fine for checking such status), but as part of public API is future proof for any internal changes.