We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fdf224 commit 82d2336Copy full SHA for 82d2336
lua/rustaceanvim/cargo.lua
@@ -60,8 +60,12 @@ end
60
---@param callback? fun(root_dir: string | nil) If `nil`, this function runs synchronously
61
---@return string | nil root_dir (if `callback ~= nil` and successful)
62
local function default_get_root_dir(file_name, callback)
63
- local path = file_name:find('%.rs$') and vim.fs.dirname(file_name) or file_name
64
- if not path then
+ local stat = vim.uv.fs_stat(file_name)
+ if not stat then
65
+ return nil
66
+ end
67
+ local path = stat.type == 'file' and vim.fs.dirname(file_name) or file_name
68
+ if not path or not vim.uv.fs_stat(path) then
69
return nil
70
end
71
0 commit comments