-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Step Into (F11) steps into transpiled JavaScript when debugging TypeScript that uses async/await #4798
Comments
@jpierson this basically a problem of the generated source map and the fact that VS Code does not (yet) tries to be smart. Here is my example: async function longRunning() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(42);
}, 3000);
});
}
async function main() {
const result = await longRunning();
console.log(`the answer to everything: ${result}`);
}
main(); As you can see in this visualization of the generated source map, the On the other hand if the source map would have a mapping for So the current behaviour isn't optimal but it is not buggy either. I've added a 'feature request' label. I'm planning to make node-debug smarter by detecting the |
I've added experimental support for automatically skipping code that has a source map but where the mapping does not exist and would end up in the generated code. This can be enabled in the launch config by setting an attribute @jpierson @felixfbecker please let me know if you think this is useful. |
@weinand If I understand you correctly, this is more an issue with TypeScript's/Babel's source map generation? I have tried out the tool with your example, but compiled with the gulpfile from my debug adapter: link I think though that transpilation that adds additional function calls is quite common and if you can somehow detect and ignore those that would be a great feature. As a user, when I land in the compiled source, it is not clear to me that I have to do a step over to get to the TS again. I tried to test the new feature by running |
@felixfbecker I've fixed the dependencies in vscode-node-debug and after removing node_modules and doing an |
@felixfbecker my experimental "smart step" feature should be independent from what transpiler tools are used to generate JavaScript and source maps. The feature should just hide generated code by auto stepping through it. If you enable the feature you can see on the console how many "step in" commands were issued. |
@weinand I am still hitting the source files. Ran git pull, rm -re -fo node_modules, npm i, gulp build, vsce package and installed it |
@felixfbecker how it should look like: https://dl.dropboxusercontent.com/u/2433608/2016-04-01%2014-23-27.mp4 (before/after) |
@weinand No idea why it's not working, can you send me your vsix? |
@felixfbecker here is my sample project: |
I meant the extension file as apparently I can't get it to compile and install correctly |
@felixfbecker I'd like to know what problems you are seeing when trying to build vscode-node-debug? Is this on Windows? I just tried it there and for me it works. |
@felixfbecker when looking at your sourec map I get the impression that the double mapping might be the issue. I'll have to try my code on the result of your way of transpiling TypScript... |
@weinand I think my Insiders build might be broken, getting all kinds of ENOENT and null pointer excs. Don't have time to investigate further right now. But +1 for the feature. |
I've add experimental support for this. You can enable this feature by adding an attribute |
I recon this |
@weinand Is I'm running TypeScript 2.0 & VSCode Insiders and having the jumping issue; although it does fix the step into issue. Demo can be seen here: https://github.com/swimlane/node-microservice-demo/tree/master/petstore by running Launch, set a breakpoint here: https://github.com/swimlane/node-microservice-demo/blob/master/petstore/src/controllers/PetStoreController.ts#L28 and then hit |
@amcdnl basically yes. But I didn't try it with the examples from mozilla/source-map#221 (because I'm not using Babel). |
Yup, I was just posting that for reference as this happens in both situations. My current use case that I posted is TypeScript.
Well a step ( pun haha ) in the right direction, do you know if there is an issue tracking the jumping somewhere? |
@amcdnl please create a new issue. |
@weinand done. Thanks for feedback. |
Steps to Reproduce:
const result = await callMyApi()
.callMyApi
function.Expected Result:
The .ts TypeScript file where callMyApi implementation exists should be opened and the debugger should be stopped on the first line of that function.
Actual Result:
The .js transpiled JavaScript file is opened and the debugger is stopped on the first line of the that file.
The text was updated successfully, but these errors were encountered: