I want to debug my scala app with vscode.
My gradle run task looks as simple:
task run(type: JavaExec, dependsOn: build) {
debug true
main = mainClassFile
classpath sourceSets.main.runtimeClasspath
classpath configurations.runtime
}
The launch entry:
{
"type": "java",
"name": "Debug (Attach)",
"request": "attach",
"hostName": "localhost",
"port": 5005
}
Now when I launch the debugger, it waits for the vscode client. But I am not able to set any breakpoints in vscode in order to stop the debugger. For now it runs until the end, after vscode connected.
I am using the Scala
and Scala Language Server
.
Does someone know how to add breakpoints?
Conditional breakpoints allow you to break inside a code block when a defined expression evaluates to true. Conditional breakpoints highlight as orange instead of blue. Add a conditional breakpoint by right clicking a line number, selecting Add Conditional Breakpoint , and entering an expression.
Latest release of Scala Metals (0.8.0) has a debug support - the release has an animation showing usage of debugging in Visual Studio Code, which works the same way as debugging in other languages.
This is an initial support so some cases might not be supported (see "known limitations" in the release notes of Metals 0.8.0), but you should be able to start using them.
Before that debugging was simply not supported by Scala Metals, and everyone writing Scala in need of such feature was recommended to use IntelliJ with Scala plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With