Skip to content

Commit 92c3ba2

Browse files
committed
feat(go.nvim): update gopls settings
1 parent 5a80bfa commit 92c3ba2

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

lua/aceforeverd/lsp/init.lua

+23-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
local M = {}
1919

20-
local lsp_basic = require('aceforeverd.lsp.common')
21-
2220
function M.setup()
2321
if vim.g.my_cmp_source ~= 'nvim_lsp' then
2422
return
@@ -51,9 +49,31 @@ function M.setup()
5149
end
5250

5351
function M.go()
52+
local go_cfg = require('aceforeverd.lsp.common').general_cfg
53+
-- https://github.com/ray-x/go.nvim?tab=readme-ov-file#nvim-lsp-setup
54+
go_cfg.settings = {
55+
gopls = {
56+
-- more settings: https://github.com/golang/tools/blob/master/gopls/doc/settings.md
57+
analyses = {
58+
unreachable = true,
59+
nilness = true,
60+
unusedparams = true,
61+
useany = true,
62+
unusedwrite = true,
63+
ST1003 = true,
64+
undeclaredname = true,
65+
fillreturns = true,
66+
nonewvars = true,
67+
fieldalignment = true,
68+
shadow = true,
69+
},
70+
}
71+
}
72+
go_cfg.capabilities.textDocument.completion.dynamicRegistration = true
73+
5474
-- :GoInstallBinaries
5575
require('go').setup({
56-
lsp_cfg = require('aceforeverd.lsp.common').general_cfg,
76+
lsp_cfg = go_cfg,
5777
textobjects = false,
5878
lsp_keymaps = false,
5979
lsp_inlay_hints = {

0 commit comments

Comments
 (0)