File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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-
2624local 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
You can’t perform that action at this time.
0 commit comments