Skip to content
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

Run test/debug not working in dependent Crate tests in VSCode #13409

Open
vlovich opened this issue Oct 13, 2022 · 0 comments
Open

Run test/debug not working in dependent Crate tests in VSCode #13409

vlovich opened this issue Oct 13, 2022 · 0 comments
Labels
A-vscode vscode plugin issues C-bug Category: bug

Comments

@vlovich
Copy link

vlovich commented Oct 13, 2022

I have:

project/
   Cargo.toml
   libs/dep/
      Cargo.toml
      src/lib.rs  

project/Cargo.toml:

[package]
edition = "2021"
name = "placeholder"
version = "0.1.0"

[dependencies]
mydep = { path = "libs/dep" }

If I open libs/dep/ as a separate VSCode project & run a test in src/lib.rs everything works as expected. If I open project/ instead and then try to run a test from libs/dep/src/lib.rs, it fails:

  1. If I click "Debug test", it prints "could not find Cargo.toml in /home/vlovich or any parent directory"
  2. If I click "Run test", it runs the test command (Executing task: cargo test -- --exact --nocapture) but I think it's in the project/ folder instead of project/libs/dep because it builds but finds 0 tests to run and it lists "placeholder" as the package that was built.

Ideally I think rust-analyzer would scan up from the current file to find the directory of the Cargo.toml instead of assuming it's the workspace root.

rust-analyzer version: Tried & failed in the same way on 0.4.1242, 0.4.1237, and 0.3.1238. I saw #13404 but this looks like a different issue since it's still present on stable.

rustc version: rustc 1.64.0 (a55dd71d5 2022-09-19)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME)

@Veykril Veykril added A-vscode vscode plugin issues C-bug Category: bug labels Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vscode vscode plugin issues C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants