You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nvim-config/lua/plugins/nvim-lspconfig.lua

45 lines
1.1 KiB

return {
{
"neovim/nvim-lspconfig",
dependencies = {
"hrsh7th/nvim-cmp", -- Autocompletion
"hrsh7th/cmp-nvim-lsp",
},
config = function()
local lspconfig = require("lspconfig")
local cmp_nvim_lsp = require("cmp_nvim_lsp")
local capabilities = cmp_nvim_lsp.default_capabilities()
lspconfig.gopls.setup {
cmd = { "gopls" },
filetypes = { "go", "gomod", "gowork", "gotmpl" },
root_dir = lspconfig.util.root_pattern("go.work", "go.mod", ".git"),
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
},
},
capabilities = capabilities, -- Autocomplete-Unterstützung
}
end,
},
{
"hrsh7th/nvim-cmp",
config = function()
local cmp = require("cmp")
cmp.setup {
mapping = cmp.mapping.preset.insert({
['<C-Space>'] = cmp.mapping.complete(),
}),
sources = {
{ name = 'nvim_lsp' },
},
}
end
}
}