如何在Scala程序中的vs代码中设置断点

问题描述 投票:9回答:1

我想用vscode调试我的Scala应用。

我的gradle运行任务看起来很简单:

task run(type: JavaExec, dependsOn: build) {
    debug true
    main = mainClassFile
    classpath sourceSets.main.runtimeClasspath
    classpath configurations.runtime
}

启动项:

{
    "type": "java",
    "name": "Debug (Attach)",
    "request": "attach",
    "hostName": "localhost",
    "port": 5005
 }

现在,当我启动调试器时,它将等待vscode客户端。但是我无法在vscode中设置任何断点以停止调试器。现在,它在连接vscode之后一直运行到最后。

我正在使用ScalaScala Language Server

有人知道如何添加断点吗?

scala debugging visual-studio-code breakpoints
1个回答
0
投票

Scala Metals的最新发行版(0.8.0)has a debug support-该发行版中的动画显示了Visual Studio Code中调试的用法,其作用与其他语言中的调试相同。

这是初始支持,因此可能不支持某些情况(请参阅Metals 0.8.0发行说明中的​​“已知限制”,但您应该可以开始使用它们。

在此之前,Scala Metals根本不支持调试,因此建议所有需要此功能的编写Scala的人都将IntelliJ与Scala插件一起使用。

© www.soinside.com 2019 - 2024. All rights reserved.