diff options
| author | bstaint <bstaint@gmail.com> | 2022-10-17 14:00:42 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-17 14:00:42 +0800 |
| commit | 2dd9e060f21eecd403736bef07ec83b73341d955 (patch) | |
| tree | c24fd2cd82254086eba5efa8063d42a48c89d0cf /lua | |
| parent | docs: update server_configurations.md (diff) | |
| download | nvim-lspconfig-2dd9e060f21eecd403736bef07ec83b73341d955.tar nvim-lspconfig-2dd9e060f21eecd403736bef07ec83b73341d955.tar.gz nvim-lspconfig-2dd9e060f21eecd403736bef07ec83b73341d955.tar.bz2 nvim-lspconfig-2dd9e060f21eecd403736bef07ec83b73341d955.tar.lz nvim-lspconfig-2dd9e060f21eecd403736bef07ec83b73341d955.tar.xz nvim-lspconfig-2dd9e060f21eecd403736bef07ec83b73341d955.tar.zst nvim-lspconfig-2dd9e060f21eecd403736bef07ec83b73341d955.zip | |
fix(rust_analyzer): path nil (#2198)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/server_configurations/rust_analyzer.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lua/lspconfig/server_configurations/rust_analyzer.lua b/lua/lspconfig/server_configurations/rust_analyzer.lua index e18cbf5a..4e95ce87 100644 --- a/lua/lspconfig/server_configurations/rust_analyzer.lua +++ b/lua/lspconfig/server_configurations/rust_analyzer.lua @@ -41,13 +41,16 @@ return { local cargo_workspace_dir = nil if cm == 0 then cargo_workspace_dir = vim.json.decode(cargo_metadata)['workspace_root'] + if cargo_workspace_dir ~= nil then + cargo_workspace_dir = util.path.sanitize(cargo_workspace_dir) + end else vim.notify( string.format('[lspconfig] cmd (%q) failed:\n%s', table.concat(cmd, ' '), cargo_metadata_err), vim.log.levels.WARN ) end - return util.path.sanitize(cargo_workspace_dir) + return cargo_workspace_dir or cargo_crate_dir or util.root_pattern 'rust-project.json'(fname) or util.find_git_ancestor(fname) |
