dotfiles/dot_config/nvim/lua/config/lsp.lua
2024-09-26 16:45:44 -05:00

32 lines
842 B
Lua

local lspconfig = require("lspconfig")
-- Neovim doesn't support snippets out of the box, so we need to mutate the
-- capabilities we send to the language server to let them know we want snippets.
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- Setup our autocompletion. These configuration options are the default ones
-- copied out of the documentation.
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
-- For `vsnip` user.
vim.fn["vsnip#anonymous"](args.body)
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "vsnip" },
},
formatting = {
format = require("lspkind").cmp_format({
with_text = true,
menu = {
nvim_lsp = "[LSP]",
},
}),
},
})