Update .config/nvim/lua/plugins/lsp.lua
This commit is contained in:
parent
2955066489
commit
d96ca2a454
1 changed files with 59 additions and 53 deletions
|
@ -1,62 +1,68 @@
|
|||
return {
|
||||
{ "williamboman/mason.nvim", opts = {} },
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
opts = {
|
||||
ensure_installed = { "gopls", "lua_ls" },
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require("lspconfig").gopls.setup {}
|
||||
require("lspconfig").lua_ls.setup {}
|
||||
end
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help"
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require("lspconfig").gopls.setup {}
|
||||
require("lspconfig").lua_ls.setup {}
|
||||
end
|
||||
},
|
||||
config = function()
|
||||
local cmp = require "cmp"
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<tab>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'vsnip' }, -- For vsnip users.
|
||||
-- { name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
{ name = 'nvim_lsp_signature_help' }
|
||||
})
|
||||
})
|
||||
end
|
||||
}
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help"
|
||||
},
|
||||
config = function()
|
||||
local cmp = require "cmp"
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<tab>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'vsnip' }, -- For vsnip users.
|
||||
-- { name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
{ name = 'nvim_lsp_signature_help' }
|
||||
})
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
opts = {
|
||||
-- add any options here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue