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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
signs = true,
update_in_insert = true,
virtual_text = {
true,
spacing = 6,
severity_limit = "Error", -- Only show virtual text on error
},
})
local function config(_config)
return vim.tbl_deep_extend("force", {
capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()),
}, _config or {})
end
lspconfig.tsserver.setup(config())
lspconfig.ccls.setup(config())
lspconfig.gopls.setup(config({
cmd = { "gopls", "serve" },
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
},
},
}))
lspconfig.sumneko_lua.setup({
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
format = {
enable = false,
-- Put format options here
-- NOTE: the value should be STRING!!
-- defaultConfig = {
-- indent_style = "space",
-- indent_size = "2",
-- },
},
},
},
on_attach = function(client)
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
end,
})
local rustopts = {
tools = {
autoSetHints = true,
hover_with_actions = true,
runnables = {
use_telescope = true,
},
inlay_hints = {
show_parameter_hints = false,
parameter_hints_prefix = "",
other_hints_prefix = "",
},
},
server = {
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
checkOnSave = {
command = "clippy",
},
},
},
},
}
require("rust-tools").setup(rustopts)
local opts = {
-- whether to highlight the currently hovered symbol
-- disable if your cpu usage is higher than you want it
-- or you just hate the highlight
-- default: true
highlight_hovered_item = true,
-- whether to show outline guides
-- default: true
show_guides = true,
}
require("symbols-outline").setup(opts)
|