-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathrust-analyzer.lua
More file actions
34 lines (32 loc) · 854 Bytes
/
rust-analyzer.lua
File metadata and controls
34 lines (32 loc) · 854 Bytes
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
local M = {}
local me = require("kide.melspconfig")
local function reload_workspace(bufnr)
local clients = vim.lsp.get_clients({ bufnr = bufnr, name = "rust-analyzer" })
for _, client in ipairs(clients) do
vim.notify("Reloading Cargo Workspace")
client:request("rust-analyzer/reloadWorkspace", nil, function(err)
if err then
error(tostring(err))
end
vim.notify("Cargo workspace reloaded")
end, 0)
end
end
M.config = {
name = "rust-analyzer",
cmd = { "rust-analyzer" },
filetypes = { "rust" },
single_file_support = true,
init_options = {
provideFormatter = true,
},
root_dir = vim.fs.root(0, { ".git", "Cargo.toml" }),
on_attach = me.on_attach,
on_init = me.on_init,
capabilities = me.capabilities({
experimental = {
serverStatusNotification = true,
},
}),
}
return M