So I ended up scratching my own itch and I just recently put together this extension that allows you to trigger the test that you have the cursor in by quickly pressing a keystroke.
On top of that, and maybe the the most useful feature, is that it remembers which test you last executed, so you can just press another keystroke to re-trigger that test. So let’s say you’re working on a test and you need to go back and forth into the code being tested, you can avoid to do so with that keystroke.
It also supports both cargo test and cargo watch as an option.
The code doesn't use the language server, and identifies tests by parsing the code around the cursor, which makes it very bug prone as it is right now. Unfortunately there's a whole ongoing discussion[1] that explains why it's hard to achieve that at the moment.
The name of the extension as it is right now is a bit unfortunate, as we had another project with the same name launch a couple of days ago, but if you want to play with it here it is:
- Extension - https://marketplace.visualstudio.com/items?itemName=fcoury.r...
- Source Code - https://github.com/fcoury/runst
Let me know your thoughts.
-- [1] https://github.com/microsoft/language-server-protocol/issues...