-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Cannot debug TypeScript file if source map is in a different directory #4705
Comments
@SetTrend Very cool repro septs. however I do not see the |
@SetTrend yes, please set 'sourceMaps' to true and 'outDir' to '${workspaceRoot)/output' and let me know if that works. If not I will reopen this issue. |
@SetTrend thanks for making the project available. There a two problems with your setup:
There is still a bug in the source-map npm module that VS Code uses which prevents that paths with single dot segments BTW, you can use forward slashes in your launch.json. They are portable and do not need escaping... BTW you can enable source map logging by adding a |
Thanks, @weinand , for your very informative answer! With your information I was now able to update the source map paths assignment. I uploaded an update to GitHub to reflect the changes I made. However, the TypeScript source is still not used by the debugger: Is that the bug you have spotted? Or is it due to #2544 ? Shouldn't we re-open #2544 anyway? It contains action items to solve an issue which haven't been implemented yet. The feature request therein is still valid. |
@SetTrend I've pulled your changes and did a 'gulp tsc' on Windows 10 but the BTW, the trace output in your screenshot looks different then my Windows 10 screenshot: Your 'src' paths on the right hand side start with 'file://' whereas mine do not. This might be another issue... |
Strange... Perhaps it's because I have some spaces in the path (see this issue)? Actually I found the three .pipe(pi.sourcemaps.write(path.relative(dest, mapsRoot) // relative to gulp.dest() folder
, { includeContent: false
, sourceRoot: path.relative(mapsRoot, tsRoot) // TypeScript source root, relative to maps root
})) The path is getting calculated. The trace log gives the correct path to the TypeScript file. It just isn't used. |
@SetTrend yes, the space in the path could be the reason why the 'src' pathes start with 'file://'. I will try to reproduce. I'll try again to explain why 'sourceRoot' is wrong (no, I will not debug the code in the gulp script because VS Code only uses the resulting source map ;-) Here is the concatenation based on the source map v3 spec:
The resulting path still has an 'output' segment. And the trace log shows the erroneous 'output' segment as well. Here is the result of the correct input:
|
@SetTrend no, spaces in paths do not result in pathes starting with 'file://': |
@SetTrend the first lookup is using a more lenient lookup that I wrote which only works for files (not locations within a file). The second is using the standard source map npm module which I cannot configure to become 'lenient'. |
@weinand Trying to use your debugging tips but microsoft/vscode-react-native#391 (apologies I put it in the wrong project) |
Just to drop a note here: I'm currently working in a full-time project working with legacy ASP.NET, so unfortunately I cannot follow my GitHub threads at this time. If you can wait: The project I'm participating in is planned to be completed in April. I'll return to VC Code R&D then. And I will then finally have time to solve a long-term issue in gulp-sourcemaps. When that issue is solved it might help solving this issue here. But I'm not sure though at this time. |
+1 |
This should work now. Please reopen if you see it again. |
It's currently not possible to debug a TypeScript file when the source map is stored in a different directory.
However, I feel it should be possible to debug TypeScript files even when the corresponding source maps are stored in a different directory.
Steps to Reproduce:
https://github.com/SetTrend/VSC-Debugger
The text was updated successfully, but these errors were encountered: