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

Feature proposal: Isolate test runs in terminal #2974

Open
andyw8 opened this issue Dec 12, 2024 · 1 comment
Open

Feature proposal: Isolate test runs in terminal #2974

andyw8 opened this issue Dec 12, 2024 · 1 comment
Labels
enhancement New feature or request server This pull request should be included in the server gem's release notes vscode This pull request should be included in the VS Code extension's release notes

Comments

@andyw8
Copy link
Contributor

andyw8 commented Dec 12, 2024

(I'm unsure how to best name this feature, so suggestions for a better title are welcome)

When trying out rust-analyzer, I noticed that running the tests via a Code Lens will 'take over' the terminal pane, e.g.

 *  Executing task: cargo test --package rust-by-example --bin rust-by-example -- tests::test_add --exact --show-output 

    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.00s
     Running unittests src/main.rs (target/debug/deps/rust_by_example-60d877ca16f231b6)

running 1 test
test tests::test_add ... ok

successes:

successes:
    tests::test_add

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

 *  Terminal will be reused by tasks, press any key to close it. 

(Note the instruction on the final line).

This approach has the nice advantage that when you scroll back, you see only output for the last run of the test, rather than previous runs, making things less noisy.

It also prevent a user's typed command from getting mangled by the text sent to the terminal by the LSP.

(I've tagged this with vscode and server as I haven't yet looked at where it's implemented)

@andyw8 andyw8 added enhancement New feature or request server This pull request should be included in the server gem's release notes vscode This pull request should be included in the VS Code extension's release notes labels Dec 12, 2024
@vinistock
Copy link
Member

Rust analyzer implements the test runs as VS Code tasks, which is what creates those new terminal panes with the "press any button to close".

I think the approach works well for Rust, but for Ruby I would be concerned that it could make it difficult to do terminal debugging. If it doesn't impact terminal debugging, then I think it should be fine to migrate.

We'd need to implement a proper task for run in terminal, which would essentially do what the current command already does. This is all on the VS Code side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server This pull request should be included in the server gem's release notes vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

No branches or pull requests

2 participants