-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git dependencies get erroneously added as workspaces #373
Comments
Hey 👋 Thanks for the detailed report 🙏 I'm not sure if there's a good solution to this for rustaceanvim, as you would want to be able to navigate through the dependency with I'd have to check if not attaching an LSP client if a file is in |
I tested on VSCode and it works like I want in this situation. |
I think just ignoring workspaces in this path would be fine (if that is possible). |
I guess |
Looks like you already have an explicit check for the normal dependency registry, so adding the same for git checkouts seems to just work. diff --git a/lua/rustaceanvim/cargo.lua b/lua/rustaceanvim/cargo.lua
index 9678aa5..f506ba1 100644
--- a/lua/rustaceanvim/cargo.lua
+++ b/lua/rustaceanvim/cargo.lua
@@ -13,11 +13,13 @@ local function get_mb_active_client_root(file_name)
local cargo_home = compat.uv.os_getenv('CARGO_HOME') or joinpath(vim.env.HOME, '.cargo')
local registry = joinpath(cargo_home, 'registry', 'src')
+ local checkouts = joinpath(cargo_home, 'git', 'checkouts')
+
---@diagnostic disable-next-line: missing-parameter
local rustup_home = compat.uv.os_getenv('RUSTUP_HOME') or joinpath(vim.env.HOME, '.rustup')
local toolchains = joinpath(rustup_home, 'toolchains')
- for _, item in ipairs { toolchains, registry } do
+ for _, item in ipairs { toolchains, registry, checkouts } do
item = os.normalize_path_on_windows(item)
if file_name:sub(1, #item) == item then
local clients = rust_analyzer.get_active_rustaceanvim_clients() |
Have you read the docs and searched existing issues?
Neovim version (nvim -v)
v0.9.5
Operating system/version
EndeavourOS
Output of :checkhealth rustaceanvim
How to reproduce the issue
Make Cargo.toml in a project:
Make src/main.rs
Use go to definition on both
jittr
andjittr_git
.jittr
works as it should, butjittr_git
's folder gets added to workspaces erroneously.Expected behaviour
Neither of these crates are added to workspaces.
Actual behaviour
:lua =vim.lsp.buf.list_workspace_folders()
shows that~/.cargo/git/checkouts/jittr-{something}
is added to lsp workspaces and then warnings from this dependency are shown as if we were editing it.The minimal config used to reproduce this issue.
The text was updated successfully, but these errors were encountered: