julia-vscode / julia-vscode

Julia extension for Visual Studio Code
https://www.julia-vscode.org/
Other
1.28k stars 202 forks source link

Add Inline CodeLens buttons to run tests or benchmarks #1307

Open SaschaMann opened 4 years ago

SaschaMann commented 4 years ago

The Go extension has inline buttons to run and debug (individual) tests or benchmarks (see the screenshot below).

It would be nice to have that option in the Julia extension as well. It would probably make sense to have these for testsets rather than individual test cases.

I like the feature in the Go extension because I have to use the mouse to navigate to the test I run anyway, so it's a bit more convenient to just click it rather than clicking to place the cursor and then moving my hands to the keyboard to hit a shortcut/command.

grafik


pfitzseb commented 4 years ago

Some comments from Slack:

Jesse Perla  19 hours ago
What about it it only worked on testset, which is easy to parse, and the assumption was that the user has set things up so the testset could be run (eg they had executed any includes or globals they require?)

Jesse Perla  19 hours ago
Otherwise I don't see how it would be possible... There are plenty of cases where people do the prep work in runtests.jl and then just have a bunch of testset in files.

Jesse Perla  19 hours ago
That said, I think this would be an extremely useful feature. I spend have of my time shift-enter on individual testset and then scrolling up after it runs to figure out where I was. It could even have a visual indicator at the top if the test was successful
ZacLN commented 4 years ago

This seems like a perfect use for CodeLens

davidanthoff commented 4 years ago

We could generally use this to run cells and codeblocks in the REPL, right? With buttons to run it normally, or in debug mode.

The test case seems tricky because Julia doesn't really seem to have a notion of reliably running a subset of tests?

pfitzseb commented 4 years ago

We could generally use this to run cells and codeblocks in the REPL, right? With buttons to run it normally, or in debug mode.

The test case seems tricky because Julia doesn't really seem to have a notion of reliably running a subset of tests?

Running tests (module setup code) is a subset of running code anyways. So let's just do the "Run Code", "Debug Code", "Run File", "Debug File" widgets if we do decide to implement this (I'm still not a huge fan of pushing editor content around without the user explicitly asking for it by running a command).

davidanthoff commented 4 years ago

We can add an option and only show these code lenses if users opt-in for now?

ChrHorn commented 4 years ago

Might be worth to check out the Test Explorer UI extension. It automatically adds code lenses for tests if you use it's api as well as more features like an explorer view and inline markers for successful/failed tests.

davidanthoff commented 4 years ago

Yes, agreed, we should consider adding a test adapter for Test Explorer UI. I wish that framework was part of VS Code core...