Skip to content

Commit 8973102

Browse files
committed
feat(rust_analyzer): do not use lspconfig.util
And some minor warning fixes
1 parent ecc6f56 commit 8973102

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

lsp/rust_analyzer.lua

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@
2121
--- Note: do not set `init_options` for this LS config, it will be automatically populated by the contents of settings["rust-analyzer"] per
2222
--- https://github.com/rust-lang/rust-analyzer/blob/eb5da56d839ae0a9e9f50774fa3eb78eb0964550/docs/dev/lsp-extensions.md?plain=1#L26.
2323

24-
local util = require 'lspconfig.util'
25-
2624
local function reload_workspace(bufnr)
2725
local clients = vim.lsp.get_clients { bufnr = bufnr, name = 'rust_analyzer' }
2826
for _, client in ipairs(clients) do
2927
vim.notify 'Reloading Cargo Workspace'
30-
client.request('rust-analyzer/reloadWorkspace', nil, function(err)
28+
client:request('rust-analyzer/reloadWorkspace', nil, function(err)
3129
if err then
3230
error(tostring(err))
3331
end
@@ -64,14 +62,11 @@ return {
6462
return
6563
end
6664

67-
local cargo_crate_dir = util.root_pattern 'Cargo.toml'(fname)
65+
local cargo_crate_dir = vim.fs.root(bufnr, 'Cargo.toml')
6866
local cargo_workspace_root
6967

7068
if cargo_crate_dir == nil then
71-
on_dir(
72-
util.root_pattern 'rust-project.json'(fname)
73-
or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])
74-
)
69+
on_dir(vim.fs.root(bufnr, { 'rust-project.json', '.git' }))
7570
return
7671
end
7772

0 commit comments

Comments
 (0)