Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging CoffeeScript in VSCode goes to .js files

I am trying to debug a CoffeeScript file in vs code. It works and I can step through the compiled.js files. However, I can't step through the actual CoffeeScript files.

Here is my launch.json file:

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

And in another window, I am running:

./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

When I set a breakpoint in the coffee file, the debugger halts on the compiled js file. I need it on the coffee file.

like image 507
joncodo Avatar asked Oct 18 '22 05:10

joncodo


2 Answers

Did you try to use

"stopOnEntry": true,
"smartStep": false

as described in https://github.com/Microsoft/vscode/issues/5963 ?

Also, always from that source, a working example (assuming a coffeescript file in your workspace named coffee.coffee:

{
    "name": "Coffee",
    "type": "node",
    "request": "launch",
    "program": "${workspaceRoot}/coffee.coffee",
    "cwd": "${workspaceRoot}",
    "sourceMaps": true,
    "stopOnEntry": true,
    "smartStep": false
}
like image 138
saniales Avatar answered Oct 20 '22 23:10

saniales


here is my launch config:

{
  "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"
      ]
    }
  ]
}
like image 37
defend orca Avatar answered Oct 20 '22 22:10

defend orca