-
Notifications
You must be signed in to change notification settings - Fork 119
smartStep should only skip unmapped lines in files that have sourcemaps #245
Comments
Original assumption for smartStep was that the sourcemapped code is the user code, and everything else should be skipped. But I can imagine someone who only wants to skip unmapped portions of files with sourcemaps, e.g. TS injected async/await code. Especially now that we have skipFiles for people who want to skip node internal files, etc. A quicker fix for VS's specific issue, can you disable skipFiles when no .ts files are in the project? |
I fixed VS by disabling smartstep, so we are not in a hurry. We'd like eventually to be able to use this feature in JS and mixed projects though... |
I want to do this. I guess source maps become more and more important, so it's a good direction to improve their support, and smartstep is a logical step on this way. But don't make source maps viral. For example, I can write my tests in pure JS, or I can work on interplaying packages, some of them written in pure JS, others transpiled. In that case I'd like to enjoy the benefit of skipping generated blablah, but I still want to visit my code. |
By default, smartStep should step over unmapped lines in a file that has a sourcemap, but not step through a .js file that doesn't have a sourcemap. I can't decide whether we should rely on skipFiles for stepping through all other files - someone can add node_modules and node_internals and whatever else they need - or if smartStep should have a mode that gives it the current behavior. We could have |
@digeff I want to make this change in vscode to see what feedback we get
Do you enable smartStep for VS? I think that's the behavior you want but I wouldn't want to break anything for you before a release. |
Currently smartStep is disabled in VS. Feel free to change this anyway you need. |
I'd like to fix this for June. smartStep could become a complex property with multiple modes. A mode for skipping unmapped lines in files with sourcemaps (async/await in TS), a mode for lines in unmapped files (e.g. node internals or node_modules, although this is better served by using skipFiles) and we can leave it open for other modes in the future. Another might be rejected promises that incorrectly break as if they are uncaught exceptions in some cases (we have a checkbox in the breakpoints view for these in the EH debugger). With this change, smartStep can look like this: "smartStep": {
"unmappedLines": true, // skip unmapped lines in files with sourcemaps (the async/await TS case)
"filesWithoutSourcemaps": false // skip lines in files without sourcemaps
} Which would let me skip async/await code injected by TS or babel, but not skip .js files in node_modules. This is the usecase that is really useful for smartStep currently. For backcompat with users' existing configs, "smartStep": {
"unmappedLines": true,
"filesWithoutSourcemaps": true
} Then after a month or so of stabilization, I'd like to enable this "unmappedLines" mode by default. People expect to step through their source files without randomly seeing generated lines in that same file, and they file issues on this on occasion. Debugging with smart step for these cases is a much nicer experience. Questions -
Thoughts @weinand, @auchenberg, @isidorn? |
Ping |
@roblourens I welcome your proposal. It would perfectly fit my use case with |
Quick feedback @roblourens
|
skipFiles will actually still hit breakpoints. It's the same as 'blackbox scripts' in Chrome devtools. skipFiles targets files with a pattern, |
@roblourens I think we should change the semantics of the existing So we could just change the implementation (and document this) without changing any launch config attributes. However, if we are planning to add more options to the The attributes
But in light of the first observation that
I suggest that we either
And if we want to add an What do you think? |
Even though skipFiles exists, it seems like skipping all files without sourcemaps is still a good heuristic for debugging user code, in many cases. And since people may be relying on that, I'm still nervous about changing what On the other hand, Side note, maybe we could have other smartStep attributes like Also I'm thinking that "rejectedPromises" really belongs as a checkbox next to the exception breakpoints options, where it already is for EH debugging. |
What I'm leaning towards right now is... just change I think "skip all code without sourcemaps" is still a good heuristic for debugging the user's code, but it also includes things like whatever random node_module includes sourcemaps. I think we should push people towards skipFiles for cases that smartStep won't cover. So the only question is how to educate people about the change. I can leave a note in the smartStep description and maybe I need an explainer question on SO or just an issue in the vscode repo. |
@roblourens I will change he you've raised the question how to document the change:
|
I've pushed the change for node-debug (legacy). |
It would be great if smartstepping would do something smart for JavaScript projects, or JavaScript files in a mixed JS/TS Project
The text was updated successfully, but these errors were encountered: