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
|
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()),
on_attach = function()
Nnoremap("gd", ":lua vim.lsp.buf.definition()<CR>")
Nnoremap("K", ":lua vim.lsp.buf.hover()<CR>")
Nnoremap("<leader>vws", ":lua vim.lsp.buf.workspace_symbol()<CR>")
Nnoremap("<leader>vd", ":lua vim.diagnostic.open_float()<CR>")
Nnoremap("[d", ":lua vim.lsp.diagnostic.goto_next()<CR>")
Nnoremap("]d", ":lua vim.lsp.diagnostic.goto_prev()<CR>")
Nnoremap("<leader>vca", ":lua vim.lsp.buf.code_action()<CR>")
Nnoremap("<leader>vrr", ":lua vim.lsp.buf.references()<CR>")
Nnoremap("<leader>vrn", ":lua vim.lsp.buf.rename()<CR>")
Inoremap("<C-h>", "<cmd>lua vim.lsp.buf.signature_help()<CR>")
end,
}, _config or {})
end
require("lspconfig").tsserver.setup(config())
require("lspconfig").ccls.setup(config())
require("lspconfig").jedi_language_server.setup(config())
require("lspconfig").svelte.setup(config())
require("lspconfig").solang.setup(config())
require("lspconfig").cssls.setup(config())
require("lspconfig").gopls.setup(config({
cmd = { "gopls", "serve" },
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
},
},
}))
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"] = {
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)
|