Skip to content
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

unable to debug nodejs code written in es6 + async await and transpiled with babel. #19973

Closed
talarari opened this issue Feb 5, 2017 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@talarari
Copy link

talarari commented Feb 5, 2017

  • VSCode Version:1.9.0
  • OS Version: OSX 10.11.5

Steps to Reproduce:

  1. clone this repository :https://github.com/talarari/vscode-debug/tree/master
  2. run npm run build to transpile code with babel
  3. run npm install
  4. set breakpoints in src/async-await.js like this (the breakpoints will move when you actually try to run...):
    image
  5. launch the project from inside vscode like this:
    image

breakpoints will break in unexpected places, stepping into and over will go to unexpected places, basically debugging will not be possible.

vscode code has an awesome debugging experience, but faced with the option of debugging vs writing async-await code, the latter wins.

would really like to have both :)
i've tried many different setups and none worked.
any project setup that will work is fine by me (babel-node,building source before running, advanced versions of node , anything else you can think of).

if there is one that works, just fork my repo and make the needed changes.
any help will be greatly appreciated.

@weinand
Copy link
Contributor

weinand commented Feb 5, 2017

@talarari please try our new node debugger by setting "type" to "node2" and see whether this makes a difference.

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Feb 5, 2017
@talarari
Copy link
Author

talarari commented Feb 6, 2017

No, doesn't help.
This is the launch config im using:
https://github.com/talarari/vscode-debug/blob/master/.vscode/launch.json

Regular es6 works fine, the problem is debugging asyc await.

@roblourens
Copy link
Member

I'm not sure we can do any better than this, the sourcemap output looks screwy. Is it better in any other debugger?

@roblourens
Copy link
Member

Actually, I think this could be fixed by microsoft/vscode-chrome-debug-core#112. But it's only an issue because the babel sourcemappings are really weird.

Where you have var a = `hello${name}`;, the a and name on the generated side are mapped correctly, but the = 'hello' part is mapped to the wrong line for some reason. We can probably be a little more clever about how we pick mappings.

@talarari
Copy link
Author

any update on this?

@mengxingshike2012
Copy link

I have followed by the instruction of this, it seems that when I try to step into next line after await in a async function, the breakpoints will break in unexpected places.
As we are using webpack2, the unconfortable thing is that we have many .babelrc files. one in project root with simple config, and one in each for the root category e.g. src/frontend, src/server, src/common..Does it matter

@weinand weinand added the bug Issue identified by VS Code Team member as probable bug label Apr 6, 2017
@chemitaxis
Copy link

Hi guys! Any news about it? Thanks!

@roblourens
Copy link
Member

microsoft/vscode-chrome-debug-core#112 was closed awhile ago and the experience should be better now. Would appreciate if someone can try it out and let me know.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

6 participants