rust/crates/rust-analyzer
Dorian Scheidt 85b9568e2d feat: Run test mod from anywhere in parent file
The "Run" feature of rust-analyzer is super useful, especially for running
individual tests or test-modules during development.

One common pattern in rust development is to develop tests in the same file as
production code, inside a module (usually called `test` or `tests`) marked with
`#[cfg(test)]`.  Unforunately, this pattern is not well supported by r-a today,
as a test module won't show up as a runnable unless the cursor is inside it.

In my experience, it is quite common to want to run the tests associated with
some production code immediately after editing it, not only after editing the
tests themselves. As such it would be better if test modules were available
from the "Run" menu even when the cursor is outside the test module.

This change updates the filtration logic for runnables in
`handlers::handle_runnables` to special case `RunnableKind::TestMod`, making
test modules available regardless of the cursor location. Other `RunnableKind`s
are unnaffected.

Fixes #9589
2022-08-17 12:26:07 -05:00
..
src feat: Run test mod from anywhere in parent file 2022-08-17 12:26:07 -05:00
tests/slow-tests run stable fmt through rustup 2022-08-06 17:25:02 +03:00
build.rs Fix typo in build.rs 2022-06-26 10:09:45 +00:00
Cargo.toml Disable all source-gen tests at compile time 2022-07-24 10:38:28 +02:00