Open GZLiew opened 6 months ago
Facing the same issue when select some rust macros. Keystroke sequence: print<tab>
https://github.com/hrsh7th/nvim-cmp/assets/75246050/9b2a87fd-8acd-4701-b202-ed409d4a845b
Facing the same issue when select some rust macros. Keystroke sequence:
print<tab>
Screen.Recording.2024-06-02.at.17.11.34.mov
mapping = {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.snippet.active({ direction = 1 }) then
vim.schedule(function()
vim.snippet.jump(1)
end)
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
}
local has_words_before = function()
---@diagnostic disable-next-line: deprecated
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
I have the same issue particularly with intelephense using lspconfig. It seems that some completion get confirmed early like the function mysqli_init
or max
, don't know what might be the problem since my config works fine before I upgraded to 0.10.0 from 0.9.5
I had this exact issue.
It turned out andymass/vim-matchup
was trying to match selection text emitted for LSP snippets (snippets from other sources such as LuaSnip do not have this issue), which makes the completion menu close then open again with the previously selected text now as the current prefix.
I just removed the plugin, and everything worked correctly.
I had this exact issue.
It turned out was trying to match selection text emitted for LSP snippets (snippets from other sources such as LuaSnip do not have this issue), which makes the completion menu close then open again with the previously selected text now as the current prefix.
andymass/vim-matchup
I just removed the plugin, and everything worked correctly.
I just removed this plugin and everything is ok, but do you know any plugin that can replace andymass/vim-matchup
?
It turned out
andymass/vim-matchup
was trying to ...
Temporarily disabling vim-matchup
works well for me:
-- plugins/vim-matchup.lua
return {
"andymass/vim-matchup",
config = function(_, opts)
local ok, cmp = pcall(require, "cmp")
if ok then
cmp.event:on("menu_opened", function() vim.b.matchup_matchparen_enabled = false end)
cmp.event:on("menu_closed", function() vim.b.matchup_matchparen_enabled = true end)
end
require("match-up").setup(opts)
end,
}
FAQ
Announcement
Minimal reproducible full config
Description
https://github.com/hrsh7th/nvim-cmp/assets/43195293/b8d59787-1bc6-45c9-a8f2-c216ab56b1ee
Steps to reproduce
https://github.com/hrsh7th/nvim-cmp/assets/43195293/b8d59787-1bc6-45c9-a8f2-c216ab56b1ee
Expected behavior
should preselect the trycatch snippet and not select and hide cmp dialog
Actual behavior
selected the trycatch snippet and hides cmp dialog
Additional context
No response