updated lspconfig
This commit is contained in:
parent
a880080590
commit
855f959141
1 changed files with 6 additions and 12 deletions
|
|
@ -1,6 +1,6 @@
|
|||
local config = function()
|
||||
-- Add additional capabilities supported by nvim-cmp
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local lspconfig = require('lspconfig')
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
|
|
@ -13,7 +13,6 @@ local config = function()
|
|||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', 'gR', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
end
|
||||
|
||||
-- Enable some language servers with the additional
|
||||
-- completion capabilities offered by nvim-cmp
|
||||
local servers = { 'gopls', 'erlangls'}
|
||||
|
|
@ -40,12 +39,11 @@ local config = function()
|
|||
}
|
||||
}
|
||||
}
|
||||
local luasnip = require 'luasnip'
|
||||
local cmp = require 'cmp'
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
|
|
@ -59,8 +57,6 @@ local config = function()
|
|||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
|
|
@ -68,8 +64,6 @@ local config = function()
|
|||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
|
|
@ -77,7 +71,7 @@ local config = function()
|
|||
}),
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'vsnip' },
|
||||
},
|
||||
}
|
||||
end
|
||||
|
|
@ -86,9 +80,9 @@ return {
|
|||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
'hrsh7th/nvim-cmp',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'hrsh7yh/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-vsnip',
|
||||
'hrsh7th/vim-vsnip',
|
||||
},
|
||||
config = config
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue