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

Move usage of Scala Debug Adapter to Metals #5928

Closed
tgodzik opened this issue Dec 8, 2023 · 8 comments
Closed

Move usage of Scala Debug Adapter to Metals #5928

tgodzik opened this issue Dec 8, 2023 · 8 comments
Assignees
Labels
debug DAP debug related tickets tech debt We should have addressed this yesterday

Comments

@tgodzik
Copy link
Contributor

tgodzik commented Dec 8, 2023

Currently, both sbt BSP and Bloop use the scala-debug-adapter library to run debug and test. However, this means each tool needs to implement integration with that library.

It would make much more sense to implement this in Metals, where any additional bsp server would be able to use it.

@tgodzik tgodzik added tech debt We should have addressed this yesterday debug DAP debug related tickets labels Dec 8, 2023
@lefou
Copy link
Contributor

lefou commented Dec 8, 2023

What is the expected impact on detecting and executing tests in Metals? Currently, Metals is not detecting tests in Mill projects when mill-bsp is used. This is due to the fact, that Metals uses the DebugProvider capability for it.

@tgodzik
Copy link
Contributor Author

tgodzik commented Dec 8, 2023

We wouldn't detect tests in Metals, we would still need to use the buildTargetScalaTestClasses endpoint. With that, we could use the jvm test environment request to get all that we need to execute test via DAP. Both of those requests are implemented in mill sbt and Bloop.

@lefou
Copy link
Contributor

lefou commented Dec 8, 2023

Great.

@tgodzik tgodzik added this to Triage in Metals Issue Board via automation Dec 11, 2023
@Arthurm1
Copy link
Contributor

How would test results be collated - is that currently done by the build server and passed back by BSP?

@tgodzik
Copy link
Contributor Author

tgodzik commented Dec 15, 2023

That's done via DAP itself as far as I know, so no change would be needed. We would need to make sure that the results are properly forwarded in case I am mistaken

@Arthurm1
Copy link
Contributor

Arthurm1 commented Jan 5, 2024

@tgodzik What does the BSP server need to implement if the Scala Debug Adapter is moved to Metals?

Does it no longer have to implement debugSession/start and just implement buildTarget/run and buildTarget/test?

And then Metals/DAP passes the debugging options in the RunParams#arguments and TestParams#arguments e.g. -Xrunjdwp... when running the program?

@tgodzik
Copy link
Contributor Author

tgodzik commented Jan 5, 2024

The plan is to just run the process inaide metals using the scala-debug-adapter library, which means we would need jvmEnvironment and mainClasses/testClasses endpoints.

At least that's my hope currently. We could try to use run/test endpoints but that would be more complicated

@tgodzik
Copy link
Contributor Author

tgodzik commented Jul 3, 2024

This should now work. For any server that doesn't implement debugging we will start things inside Metals, though we still need test discovery to be done on the server side.

@tgodzik tgodzik closed this as completed Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug DAP debug related tickets tech debt We should have addressed this yesterday
Projects
Development

No branches or pull requests

4 participants