-
Notifications
You must be signed in to change notification settings - Fork 39.5k
Description
Describe the bug
I wanted to configure some setting for few of LSP servers that I'm currently using. First I wanted to experiment with gopls, but even tho I've used their settings documentation I couldn't change the default settings. I'm quite new to Vim/Neovim & LSP land so not really sure how I can debug it properly.
I tried to look up the mason_lspconfig.setup_handlers{}
function as this seemed as something there might be misconfigured. I opened and read the help and there is an example how to overwrite specific LSP server configuration, which I used to check if this may help and seems like it did the trick.
To Reproduce
So basically having following servers configuration
local servers = {
gopls = {
analyses = {
unusedparams = true,
shadow = true,
loopclousure = false,
},
staticcheck = true,
},
...
}
I don't get shadow and ususedparams analyses.
But if I put targeted override like following:
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
}
end,
["gopls"] = function()
require('lspconfig').gopls.setup {
settings = {
gopls = {
analyses = {
unusedparams = true,
shadow = true,
loopclousure = false,
},
staticcheck = true,
},
}
}
end,
}
All seems to work perfectly fine and I get additional diagnostic warnings for unused params and shadowed variables.
Desktop (please complete the following information):
- OS: Linux 5.11.22-2-MANJARO
- Terminal: zsh
Neovim Version
NVIM v0.8.3
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser