8 event = { "BufReadPre", "BufNewFile" }, |
8 event = { "BufReadPre", "BufNewFile" }, |
9 dependencies = { |
9 dependencies = { |
10 { "williamboman/mason-lspconfig.nvim", config = true }, |
10 { "williamboman/mason-lspconfig.nvim", config = true }, |
11 }, |
11 }, |
12 config = function(_, _) |
12 config = function(_, _) |
13 local capabilities = require("cmp_nvim_lsp").default_capabilities() |
13 local lspconfig = require("lspconfig") |
|
14 |
|
15 lspconfig.util.default_config.capabilities = vim.tbl_deep_extend("force", |
|
16 lspconfig.util.default_config.capabilities, |
|
17 require("cmp_nvim_lsp").default_capabilities() |
|
18 ) |
|
19 |
|
20 -- allow view / -R to also stop autostart. no other global flag for this. |
|
21 lspconfig.util.default_config.autostart = not vim.list_contains(vim.v.argv, "-R") |
14 |
22 |
15 require("mason-lspconfig").setup_handlers({ |
23 require("mason-lspconfig").setup_handlers({ |
16 function(server) |
24 function(server) lspconfig[server].setup({}) end, |
17 require("lspconfig")[server].setup({ capabilities = capabilities }) |
|
18 end, |
|
19 gopls = function() |
25 gopls = function() |
20 require("lspconfig").gopls.setup({ |
26 lspconfig.gopls.setup({ |
21 capabilities = capabilities, |
|
22 settings = { |
27 settings = { |
23 -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md |
28 -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md |
24 gopls = { |
29 gopls = { |
25 analyses = { |
30 analyses = { |
26 unusedvariable = true, |
31 unusedvariable = true, |