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

Debugger isn't showing TypeScript source #2544

Closed
SetTrend opened this issue Jan 29, 2016 · 6 comments
Closed

Debugger isn't showing TypeScript source #2544

SetTrend opened this issue Jan 29, 2016 · 6 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality
Milestone

Comments

@SetTrend
Copy link

In a TypeScript project the VS Code debugger displays the generated JavaScript code instead of the TypeScript code:

vscode debugger no typescript

What's wrong?

Shouldn't the IDE better emit a warning when it can't find the corresponding map referenced in a file and provide a list of locations to the user listing where it's unsuccessfully been searching for the original source?

See this sample repository for a reference: SetTrend/TS18N.

@weinand weinand added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels Jan 29, 2016
@weinand weinand self-assigned this Jan 29, 2016
@weinand
Copy link
Contributor

weinand commented Feb 2, 2016

@SetTrend Thanks for providing the sample repository. I tried this with VS Code 0.10.6 on Windows 10 and I don't see a VS Code problem here.

The debugger stops in the *.js file because the source map does not have a mapping for the first line ("use strict"). If you perform one step, the debugger will hit the first line in the TypeScript file just fine. The VS Code strategy for dealing with missing mappings is to show the "truth" (i.e. the *.js file) and not "invent" a bogus location in the TypeScript source.

BTW, this source map visualisation shows the missing mapping:

visualisation

@weinand weinand closed this as completed Feb 2, 2016
@SetTrend
Copy link
Author

SetTrend commented Feb 2, 2016

@weinand :

Thank you very much for taking the time to shed light on my problem and solving it! 👏 😄

@weinand
Copy link
Contributor

weinand commented Feb 2, 2016

I'm glad that I was able to shed some light on this (and that I do not have to fix a bug here 😎)

@SetTrend
Copy link
Author

SetTrend commented Feb 2, 2016

😸

Well, if I may still add a humble wish:

I now am aware of this behaviour. But other users may not be. And I may be confused myself again when the mapped source won't be displayed after stepping over a number of lines (which is a use case that may occur).

If I'm not wrong then it is still not possible to distinguish between an incorrect mapping file / mapping source file location and a situation when a mapping is not available for a certain code point.

I believe it would be helpful if there was some minor visual cue provided by Code (e.g. a short message in the status bar) when hitting such break point, informing the user that everything in regard to mapping file locations is alright, there's just no mapping for the current position and the original source is used for the current breakpoint. E.g. No mapping in mapped source for code at breakpoint. Using original source.

@weinand weinand removed the bug Issue identified by VS Code Team member as probable bug label Feb 2, 2016
@weinand weinand added this to the Backlog milestone Feb 2, 2016
@weinand weinand added the feature-request Request for new features or functionality label Feb 2, 2016
@weinand
Copy link
Contributor

weinand commented Feb 2, 2016

Valid request, but this will require a protocol addition and we will have to spend some design cycles on this...
We could piggyback this info on the Stopped event and show it either in the stack:

2016-02-02 22-54-02

or in the editor header:

2016-02-02 22-55-46

@isidorn what do you think?

@isidorn
Copy link
Contributor

isidorn commented Feb 3, 2016

@weinand maybe instead decorate the file name in the callstack in gray / red and on hover show the info that the mapping is missing.
Or a combination of your first idea with this?
'Paused on entry. Some source maps missing'
And then the call stack could indicate which one

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants