Description
There are two main properties of the launch.json that people get tripped up on configuring, the sourceMapPathOverrides
and outFiles
. Both these could be figured out with a decent degree of fidelity once the program is running, so I suggest adding a "test run" mode.
-
sourceMapPathOverrides
can usually involves suffix-matching against paths from the sourcemaps, which can be overlaid and compared with the workspace. For example,ng:///src/index.ts
could matchsrc/index.ts
automatically. In some cases, there might be multiple prefixes, such aswebpack://package-a/src/index.ts
andwebpack://package-b/src/index.ts
. In ambiguous cases like this, we might be able to figure things out automatically if disk sources match exactly, or interactively ask the user otherwise.The Chrome devtools can do something like this today, although this feature is not very widely known or used as far as I know, so I'm not sure how thorough their implementation is.
-
the
webRoot
/cwd
follows the same logic as this too, for non-sourcemapped files. -
outFiles
can be done more simply by running the program and then generating a glob or list of globs which match all scripts containing sourcemaps that are loaded by the program, excluding those in the node_modules. In the special case when a file in the runtime has a sourcemap but its version on disk doesn't, it does not need to be included (e.g. ts-node Since latest update I'm getting "It's taking a while to configure your breakpoints." message vscode#142830 (comment))
The major question here is discoverability of this "auto configuration" mode. Perhaps it can be suggested if breakpoints don't get bound, similar to the suggester we have today (but maybe more aggressive).