-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathgo.lua
44 lines (43 loc) · 1.74 KB
/
go.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
local opts = {
settings = {
gopls = {
gofumpt = true, -- A stricter gofmt
codelenses = {
gc_details = true, -- Toggle the calculation of gc annotations
generate = true, -- Runs go generate for a given directory
regenerate_cgo = true, -- Regenerates cgo definitions
test = true,
tidy = true, -- Runs go mod tidy for a module
upgrade_dependency = true, -- Upgrades a dependency in the go.mod file for a module
vendor = true, -- Runs go mod vendor for a module
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
diagnosticsDelay = "300ms",
symbolMatcher = "fuzzy",
completeUnimported = true,
staticcheck = true,
matcher = "Fuzzy",
usePlaceholders = true, -- enables placeholders for function parameters or struct fields in completion responses
analyses = {
fieldalignment = true, -- find structs that would use less memory if their fields were sorted
nilness = true, -- check for redundant or impossible nil comparisons
shadow = true, -- check for possible unintended shadowing of variables
unusedparams = true, -- check for unused parameters of functions
unusedwrite = true, -- checks for unused writes, an instances of writes to struct fields and arrays that are never read
},
},
},
on_attach = function(client, bufnr)
require("lvim.lsp").common_on_attach(client, bufnr)
local _, _ = pcall(vim.lsp.codelens.refresh)
end,
}
require("lvim.lsp.manager").setup("gopls", opts)