Skip to content

Commit

Permalink
fix(cmp): occasional inability to select completion items (#1315)
Browse files Browse the repository at this point in the history
Signed-off-by: Jint-lzxy <[email protected]>
Signed-off-by: ayamir <[email protected]>
Co-authored-by: ayamir <[email protected]>
  • Loading branch information
Jint-lzxy and ayamir authored Jul 1, 2024
1 parent b1406ca commit 757a36e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lua/modules/configs/completion/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ return function()
},
-- You can set mappings if you want
mapping = cmp.mapping.preset.insert({
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-w>"] = cmp.mapping.close(),
["<C-w>"] = cmp.mapping.abort(),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
elseif require("luasnip").expand_or_locally_jumpable() then
require("luasnip").expand_or_jump()
else
Expand All @@ -143,7 +143,7 @@ return function()
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
Expand Down

0 comments on commit 757a36e

Please sign in to comment.