在 VSCode 中调试 CoffeeScript 转到 .js 文件

Debugging CoffeeScript in VSCode goes to .js files

我正在尝试在 vs 代码中调试 CoffeeScript 文件。它有效,我可以单步执行 compiled.js 个文件。但是,我无法单步执行实际的 CoffeeScript 文件。

这是我的 launch.json 文件:

{
    "type": "node",
    "request": "launch",
    "name": "Launch Meeting",
    "program": "${workspaceRoot}/lib/meeting/meeting-service.coffee",
    "cwd": "${workspaceRoot}",
    "env": {
        "NODE_ENV": "local"
    },
    "sourceMaps": true
}

在另一个window中,我是运行:

./node_modules/.bin/coffee -mc --watch lib/activity/note-activity-model.coffee \
                                       lib/activity/note-activity-publisher.coffee \
                                       lib/app-event-queue.coffee \
                                       lib/meeting/meeting-api.coffee \
                                       lib/meeting/meeting-service.coffee \
                                       lib/meeting/meeting-socket-service.coffee \
                                       lib/meeting/meeting-util.coffee

当我在 coffee 文件中设置断点时,调试器在编译的 js 文件上停止。我需要它在咖啡文件上。

你试过使用

"stopOnEntry": true,
"smartStep": false

https://github.com/Microsoft/vscode/issues/5963 所述?

此外,始终来自该源,一个工作示例(假设您的工作区中有一个名为 coffee.coffee:

的 coffeescript 文件
{
    "name": "Coffee",
    "type": "node",
    "request": "launch",
    "program": "${workspaceRoot}/coffee.coffee",
    "cwd": "${workspaceRoot}",
    "sourceMaps": true,
    "stopOnEntry": true,
    "smartStep": false
}

这是我的启动配置:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "skipFiles": [
        "<node_internals>/**"
      ],
      "program": "${file}", //improtant, that debug current coffee.
      "outFiles": [ //most important, can not debug without this.
        "${workspaceFolder}/dist/api/api.js"
      ]
    }
  ]
}