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
|
vim.lsp.inlay_hint.enable(true)
vim.lsp.enable({
"clangd",
"lua_ls",
"nixd",
"nil_ls",
"zls",
"pyrefly",
"marksman",
"harper",
"tinymist",
"gopls",
"tombi",
})
vim.lsp.config("nil_ls", {
settings = {
formatting = {
command = { "nixfmt" },
},
},
})
vim.lsp.config("lua_ls", {
settings = {
Lua = {
codeLens = { enable = true },
hint = {
enable = false,
semicolon = "Disable",
},
workspace = {
checkThirdParty = false,
-- IMPORTANT: Leave library empty here.
-- lazydev will inject the correct Nix store paths dynamically.
library = {},
},
runtime = {
version = "LuaJIT",
-- Setting this to false allows lazydev to find files
-- outside your immediate workspace (like Nix store plugins)
pathStrict = false,
},
},
},
})
vim.lsp.config("*", {
capabilities = { textDocument = { semanticTokens = { multilineTokenSupport = true } } },
root_markers = { ".git", ".editorconfig", "flake.nix", "shell.nix" },
})
vim.diagnostic.config({
severity_sort = true,
severity_sort_priority = {
Error = 100,
Warn = 90,
Hint = 50,
Info = 10,
},
})
local RustLsp = function(mode, keymap, action, bufnr)
vim.keymap.set(mode, keymap, function()
vim.cmd.RustLsp(action)
end, { silent = true, buffer = bufnr })
end
vim.g.rustaceanvim = {
tools = {},
server = {
on_attach = function(client, bufnr)
RustLsp({ "n", "x" }, "gra", "codeAction", bufnr)
RustLsp("n", "<leader>ee", "explainError", bufnr)
RustLsp("n", "K", { "hover", "actions" }, bufnr)
RustLsp("n", "L", { "hover", "range" }, bufnr)
end,
default_settings = {
["rust-analyzer"] = {
checkOnSave = {
enable = true,
command = "clippy",
},
procMacro = {
enable = true,
},
},
},
},
dap = {},
}
|