lsp: update CR mapping function
This commit is contained in:
@@ -46,20 +46,17 @@ return {
|
|||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
-- `Enter` key to confirm completion
|
-- `Enter` key to confirm completion
|
||||||
['<CR>'] = cmp.mapping(function(fallback)
|
["<CR>"] = cmp.mapping({
|
||||||
if cmp.visible() then
|
i = function(fallback)
|
||||||
if luasnip.expandable() then
|
if cmp.visible() and cmp.get_active_entry() then
|
||||||
luasnip.expand()
|
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
|
||||||
else
|
|
||||||
cmp.confirm({
|
|
||||||
select = false,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end),
|
end,
|
||||||
|
s = cmp.mapping.confirm({ select = true }),
|
||||||
|
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||||
|
}),
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
|
|||||||
Reference in New Issue
Block a user