scalameta / metals-feature-requests

Issue tracker for Metals feature requests
37 stars 4 forks source link

Run tests without Scala Debug Adapter #392

Open tgodzik opened 3 months ago

tgodzik commented 3 months ago

Is your feature request related to a problem? Please describe.

It seems that even when running test without debug on it takes a large amount of time to start the tests. This could be quicker and DAP is not neccessary here.

Describe the solution you'd like

Use the approach that we had for Native (or similar) to fake a DAP server instead of running via DAP.

We could even do that for Bloop also.

Describe alternatives you've considered

Using the current mechanism

Additional context

No response

Search terms

debug test run

adpi2 commented 3 months ago

It seems that even when running test without debug on it takes a large amount of time to start the tests. This could be quicker and DAP is not neccessary here.

It is true that DAP is not necessary here, but do we know what's taking time here? Because maybe it is just the compilation and that's not a step we can skip.

I tested on the Scala 3 compiler repo: it takes about 50 seconds to compile the first time but then starting the tests takes less than 1s

tgodzik commented 3 months ago

For running main the difference is noticable, but maybe it's not really a big issue :thinking:

https://github.com/scalameta/metals-feature-requests/assets/3807253/35c55ac2-1e58-4f03-9b17-a1da64f19aaa

When testing simple project it seems a bit slower that it should though:

https://github.com/scalameta/metals-feature-requests/assets/3807253/554cc786-af4e-42cf-95f2-33066ecc292a

Maybe this not a huge win to run under plain java, but on the other hand we don't need any DAP related stuff when debug is disabled and for sure it add something to the execution time.

Overall, not a big issue probably

adpi2 commented 3 months ago

It would be useful to trace the BSP and DAP sequence to see what is so slow.

adpi2 commented 3 months ago

It would be useful to trace the BSP and DAP sequence to see what is so slow.

The whole process takes about 1-2 seconds on my laptop and I don't have enough precision (seconds) in the traces for it to be meaningful.

However it seems that the debugger is quite fast to start, and I can even see the logs of the debuggee almost immediately, but the test result is appearing some time later in the UI. Could it be that the debugger is slow to stop or that Metals or VSCode are slow to process the test outputs?

tgodzik commented 3 months ago

Good question, I guess figuring that out would be the first step here. Might be an issue with VS Code setup for DAP :thinking: