-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add support for debugSession/start
in sbt-metals
plugin
#168
Comments
Thanks for reporting! We should have put it here a while ago 😓 |
Thanks for the request @adpi2! My initial opinion would be that this really shouldn't belong in Metals. Having the build server provide DAP capabilities seems to be the more logical place for this to live. From my understanding the Build Server in the future will even declare whether or not it's a DAP provider in the |
It sounds right @ckipp01. Also the dependency to
Nice! I think it is possible to override sbt |
We've been talking about it with @adpi2 and we decided to put it here as a feature request, since we are the most invested party here. Overall, I was thinking we would:
I am not yet sure how to do it in a plugin infrastructure and much more work might be needed here also on the sbt side. @ckipp01 do you think it makes sense? I really appreciate your feedback here, I have left out a lot of information before. |
I don't have a strong opinion. It may seem weird that the sbt implementation is a stub but also it makes the interface more stable for users. @eed3si9n what's your take on it? |
@adpi2 I guess I was going down the path of implementing it in It seems like |
Not really because a plugin can extend the sbt server with any any json-rpc request (or notification): object DAPPlugin extends AutoPlugin {
val buildSettings = Seq(
serverHandlers += ServerHandler { callback =>
request {
case r: JsonRpcRequestMessage if r.method == "debugSession/start") => ???
}
}
)
} Also of course you can add your own tasks and settings in a plugin: https://www.scala-sbt.org/1.x/docs/Plugins.html EDIT: Fundamentally the BuildServerProtocol could be a plugin in sbt |
Awesome, I think that solves it really. It seems it should be doable by extracting some code from Bloop https://github.com/scalacenter/bloop/tree/master/frontend/src/test/scala/bloop/dap |
True, but I also think that it's important that the DAP implementation for sbt be as client-agnostic as it's able to be so that down the road if another tool wants to tie into it, it's easier.
I'm all for taking the
I guess this is where I may differ in opinion a bit, but does this really make the most sense to have this under scalameta? Will the DAP implementation for sbt not be generic to use with another client? With my limited knowledge of DAP I sort of assumed that this wouldn't be really coupled to Metals really at all. I mainly bring this up because as we are all probably aware, more repos/projects add to maintenance time and upkeep. Since this one seems quite sbt specific, it makes more sense for this to be done on the sbt side. Again, that's just my opinion, and me trying to be careful with the amount of stuff we are committing to maintaining. Please note that I don't speak for all of Scalameta, this is just my opinion and something that I think we should be mindful of.
Well there really isn't a handoff to All this to say, let's work together, come up with a solution that hopefully works well for everyone. It's been fantastic to see the sbt BSP support growing, more people using it, and things getting ironed out. |
To summarize:
Questions:
|
I propose to create a
Also I think we can put the sbt plugin inside the same repo in a distinct module. As @ckipp01 puts it, DAP is not coupled to Metals, so its preferable to separate those two. In the future, once the project is mature enough, we can always discuss with sbt maintainers to merge it in sbt. |
That all sounds great @adpi2! Can we maybe call it |
|
Good point. Sounds good to me! |
@er1c if you plan on working on it and need any help at all please let me know anytime. |
The v1.0.0 of the scala-debug-adapter is released: https://github.com/scalacenter/scala-debug-adapter/releases/tag/v1.0.0 |
Is your feature request related to a problem? Please describe.
It is currently not possible to run the tests or start an application in Metals with sbt server, because
debugSession/start
is not implemented.Metals expects the
debugSession/start
request to start a DAP server.Describe the solution you'd like
Implement
debugSession/start
and the DAP protocol in thesbt-metals
plugin.Describe alternatives you've considered
It could be implemented in sbt but we don't want to add the dependency to vs-code-java-debug in sbt.
Additional context
More information about implementation in Bloop: https://scalacenter.github.io/bloop/docs/debugging-reference
Microsoft implementation of DAP for java: https://github.com/microsoft/vscode-java-debug
Implementation in Bloop that extends
vscode-java-debug
: https://github.com/scalacenter/bloop/tree/master/frontend/src/test/scala/bloop/dapImplementation of BSP in sbt: https://github.com/sbt/sbt/blob/develop/main/src/main/scala/sbt/internal/server/BuildServerProtocol.scala
Search terms:
sbt, server, DAP, debug, run, test
The text was updated successfully, but these errors were encountered: