Skip to content

Commit 8302d5f

Browse files
committed
nvim: rework go ft
1 parent c69be37 commit 8302d5f

File tree

1 file changed

+106
-21
lines changed

1 file changed

+106
-21
lines changed

home/nvim/ftplugin/go.lua

Lines changed: 106 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,109 @@ vim.lsp.start({
4242
capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()),
4343
settings = {
4444
gopls = {
45+
-- Build: https://github.com/golang/tools/blob/master/gopls/doc/settings.md#build
4546
buildFlags = { "-tags=unit,integration,e2e" },
47+
-- env = {},
48+
directoryFilters = { "-.git" },
49+
-- templateExtensions = {},
50+
-- expandWorkspaceToModule = true,
51+
-- standaloneTags = { "ignore" },
52+
-- workspaceFiles = {},
53+
54+
-- Formatting: https://github.com/golang/tools/blob/master/gopls/doc/settings.md#formatting
55+
-- local = "",
4656
gofumpt = true,
47-
codelenses = {
48-
gc_details = true,
49-
generate = true,
50-
regenerate_cgo = true,
51-
run_govulncheck = true,
57+
-- UI: https://github.com/golang/tools/blob/master/gopls/doc/settings.md#ui
58+
codelenses = { -- https://github.com/golang/tools/blob/master/gopls/doc/codelenses.md
59+
-- generate = true,
60+
-- regenerate_cgo = true,
5261
test = true,
53-
tidy = true,
54-
upgrade_dependency = true,
55-
vendor = true,
62+
-- run_govulncheck = false,
63+
-- tidy = true,
64+
-- upgrade_dependency = true,
65+
-- vendor = true,
66+
vulncheck = true,
67+
},
68+
semanticTokens = true,
69+
-- noSemanticString = false,
70+
-- noSemanticNumber = false,
71+
-- semanticTokenTypes = {},
72+
-- semanticTokenModifiers = {},
73+
74+
-- Completion: https://github.com/golang/tools/blob/master/gopls/doc/codelenses.md
75+
-- usePlaceholders = false,
76+
-- experimentalPostfixCompletions = true,
77+
-- completeFunctionCalls = true,
78+
79+
-- Diagnostic: https://github.com/golang/tools/blob/master/gopls/doc/settings.md#diagnostic
80+
analyses = { -- https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md
81+
-- appends = true,
82+
-- asmdecl = true,
83+
-- assign = true,
84+
-- atomic = true,
85+
-- atomicalign = true,
86+
-- bools = true,
87+
-- buildtag = true,
88+
-- cgocall = true,
89+
-- composites = true,
90+
-- copylocks = true,
91+
-- deepequalerrors = true,
92+
-- defers = true,
93+
-- deprecated = true,
94+
-- directive = true,
95+
-- embed = true,
96+
-- errorsas = true,
97+
-- fillreturns = true,
98+
-- framepointer = true,
99+
-- gofix = true,
100+
-- hostport = true,
101+
-- httpresponse = true,
102+
-- ifaceassert = true,
103+
-- infertypeargs = true,
104+
-- loopclosure = true,
105+
-- lostcancel = true,
106+
-- modernize = true,
107+
-- nilfunc = true,
108+
-- nilness = true,
109+
-- nonewvars = true,
110+
-- noresultvalues = true,
111+
-- printf = true,
112+
-- shadow = false, -- useful, but to spammy with `err`
113+
-- shift = true,
114+
-- sigchanyzer = true,
115+
-- simplifycompositelit = true,
116+
-- simplifyrange = true,
117+
-- simplifyslice = true,
118+
-- sortslice = true,
119+
-- stdmethods = true,
120+
-- stdversion = true,
121+
-- stringintconv = true,
122+
-- structag = true,
123+
-- testinggoroutine = true,
124+
-- tests = true,
125+
-- timeformat = true,
126+
-- unmarshal = true,
127+
-- unreachable = true,
128+
-- unsafeptr = true,
129+
-- unusedfunc = true,
130+
-- unusedparams = true,
131+
-- unusedresult = true,
132+
-- unusedvariable = true,
133+
-- unusedwrite = true,
134+
-- waitgroup = true,
135+
-- yield = true,
56136
},
57-
hints = {
137+
staticcheck = true,
138+
vulncheck = "Imports",
139+
140+
-- Documentations: https://github.com/golang/tools/blob/master/gopls/doc/settings.md#documentation
141+
-- hoverKind = "FullDocumentation",
142+
-- linkTarget = "pkg.go.dev",
143+
-- linksInHover = true, -- default
144+
-- linksInHover = "gopls", -- this enables offline doc links
145+
146+
-- Inlayhint: https://github.com/golang/tools/blob/master/gopls/doc/settings.md#inlayhint
147+
hints = { -- https://github.com/golang/tools/blob/master/gopls/doc/inlayHints.md
58148
assignVariableTypes = true,
59149
compositeLiteralFields = true,
60150
compositeLiteralTypes = true,
@@ -63,19 +153,14 @@ vim.lsp.start({
63153
parameterNames = true,
64154
rangeVariableTypes = true,
65155
},
66-
analyses = {
67-
fieldalignment = false, -- useful, but better optimize for readability
68-
shadow = false, -- useful, but to spammy with `err`
69-
nilness = true,
70-
unusedparams = true,
71-
unusedwrite = true,
72-
useany = true,
73-
},
74-
usePlaceholders = true,
156+
157+
-- Navigation: https://github.com/golang/tools/blob/master/gopls/doc/settings.md#navigation
158+
-- importShortcut = "Both",
159+
-- symbolScope = "all",
160+
161+
-- Internal
75162
completeUnimported = true,
76-
staticcheck = true,
77-
directoryFilters = { "-.git" },
78-
semanticTokens = true,
163+
deepCompletion = true,
79164
},
80165
},
81166
})

0 commit comments

Comments
 (0)