lsp: update CR mapping function
This commit is contained in:
@@ -29,7 +29,7 @@ return {
|
|||||||
require('mason-lspconfig').setup({
|
require('mason-lspconfig').setup({
|
||||||
-- Replace the language servers listed here
|
-- Replace the language servers listed here
|
||||||
-- with the ones you want to install
|
-- with the ones you want to install
|
||||||
ensure_installed = { 'tsserver', 'lua_ls', 'gopls', 'pylsp', 'gitlab_ci_ls', 'yamlls', 'ansiblels', 'terraformls'},
|
ensure_installed = { 'tsserver', 'lua_ls', 'gopls', 'pylsp', 'gitlab_ci_ls', 'yamlls', 'ansiblels', 'terraformls' },
|
||||||
handlers = {
|
handlers = {
|
||||||
function(server_name)
|
function(server_name)
|
||||||
require('lspconfig')[server_name].setup({})
|
require('lspconfig')[server_name].setup({})
|
||||||
@@ -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
|
else
|
||||||
cmp.confirm({
|
fallback()
|
||||||
select = false,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
else
|
end,
|
||||||
fallback()
|
s = cmp.mapping.confirm({ select = true }),
|
||||||
end
|
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||||
end),
|
}),
|
||||||
|
|
||||||
["<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