Search code examples
debuggingvisual-studio-codebreakpointsvscode-extensions

Is it possible to "blackbox" or skip other extensions when debugging vscode extensions?


I have an issue where my development environment has a few large extensions in it, and debugging my own extension using the "All exceptions" and/or "Promise rejects" breakpoints will hit on them quite frequently.

I am aware of the skipFiles option in the launch configuration, and that you can use a custom "Data" folder when launching code with the --user-data-dir option, but neither of these solutions seem to work for me. I can't figure out how to find generically define the extensions folder with skipFiles, and --user-data-dir doesn't seem to work as I'd expected and doesn't seem to be for my purpose.

To put it plainly, my ideal situation would be to use the debug shortcut F5 and for a completely sterile version of vscode to launch with only my extension loaded and settings which aren't inherited from my development environment.

In the following image of a breakpoint being hit, you can see that the first party extension "git" in the path "/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/src/git.ts" is still being tracked. The command line switch --disable-extensions does not exclude this either.


Solution

  • You can disable all other extensions when debugging your own extension via the --disable-extensions flag. Just pass it via the args attribute in your launch.json:

    "args": [
        "--disable-extensions"
    ]