rust-lang/vscode-rust

"Run test" codelens runs the wrong test

dsyer opened this issue · 4 comments

dsyer commented

In the rustlings project there is a codelens on the test in tests1.rs. When you click on it you get this:

    Running tests/integration_tests.rs (target/debug/deps/integration_tests-db54af64180db0fc)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 22 filtered out; finished in 0.00s

So it ran some random global test suite and ignored the test the codelens was on.

rustlings has a bit of a weird project structure that doesn't work well with IDEs, neither RLS, nor rust-analyzer. See e.g. rust-lang/rustlings#917.

PS: unless you aren't already, you should try rust-analyzer, though it still doesn't work with rustlings.

dsyer commented

I tried it, but it barfs

rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /workspaces/rustlings/Cargo.toml, cargo 1.59.0 (49d8809dc 2022-02-10): Failed to run `"cargo" "metadata" "--format-version" "1" "--features" "exercises" "--manifest-path" "/workspaces/rustlings/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu"`: `cargo metadata` exited with an error: error: none of the selected packages contains these features: exercises

Maybe that's what you meant by "it still doesn't work with rustlings".

It appears to be an alternative to vscode-rust? So I guess it doesn't help fix this issue.

If you applied the setting from rust-lang/rustlings#917 (comment), you'll also need to pull in the changes from the same PR: https://github.com/rust-lang/rustlings/pull/917/files.

There's also https://github.com/jackos/rustlings-fix/ as an alternative, but I haven't tried either of them.

I mentioned rust-analyzer because you filed an issue here, but vscode-rust is de-facto unmaintained.

dsyer commented

vscode-rust is de-facto unmaintained.

Good to know. It's a shame that it looks like the "official" extension then.