Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
Take 'skipFiles' name over 'blackbox', and blackbox chrome-extension:…
Browse files Browse the repository at this point in the history
…// files by default
  • Loading branch information
roblourens committed Nov 28, 2016
1 parent 67b5b66 commit c3b05bd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ See our wiki page for some configured example apps: [Examples](https://github.co
```
If you set `sourceMapPathOverrides` in your launch config, that will override these defaults. `${workspaceRoot}` and `${webRoot}` can be used here. If you aren't sure what the left side should be, you can use the `.scripts` command (details below). You can also use the `diagnosticLogging`/`verboseDiagnosticLogging` options to see the contents of the sourcemap, or look at the paths of the sources in Chrome DevTools, or open your `.js.map` file and check the values manually.

* `experimentalLibraryCode`: An array of names of folders/files to skip when debugging. For example, if you set `"experimentalLibraryCode": ["jquery.js"]`, then you will skip any file named 'jquery.js' when stepping through your code. You also won't break on exceptions thrown from 'jquery.js'. This works the same as "blackboxing scripts" in Chrome DevTools. Note that this is just an experiment at the moment. The format for entries is also the same, so you can add
* `experimentalSkipFiles`: An array of names of folders/files to skip when debugging. For example, if you set `"experimentalSkipFiles": ["jquery.js"]`, then you will skip any file named 'jquery.js' when stepping through your code. You also won't break on exceptions thrown from 'jquery.js'. This works the same as "blackboxing scripts" in Chrome DevTools. Note that this is just an experiment at the moment. The supported formats are:
* The name of a file (like `jquery.js`)
* The name of a folder, under which to skip all scripts (like `node_modules`)
* A regex, to skip all scripts that match (like `\.min\.js$`)
* A path glob, to skip all scripts that match (like `node_modules/react/*.min.js`)

## Ionic/gulp-sourcemaps note
Ionic and gulp-sourcemaps output a sourceRoot of `"/source/"` by default. If you can't fix this via your build config, I suggest this setting:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@
"description": "Automatically step through generated code that cannot be mapped back to the original source.",
"default": true
},
"experimentalLibraryCode": {
"experimentalSkipFiles": {
"type": "array",
"description": "An array of file or folder names, or path regexes, to skip when debugging.",
"description": "An array of file or folder names, or path globs, to skip when debugging.",
"default": []
}
}
Expand Down
11 changes: 8 additions & 3 deletions src/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/

import {ChromeDebugAdapter as CoreDebugAdapter, logger, utils as coreUtils, ISourceMapPathOverrides} from 'vscode-chrome-debug-core';
import {ChromeDebugAdapter as CoreDebugAdapter, logger, utils as coreUtils, ISourceMapPathOverrides, ICommonRequestArgs} from 'vscode-chrome-debug-core';
import {spawn, ChildProcess} from 'child_process';
import Crdp from 'chrome-remote-debug-protocol';
import {DebugProtocol} from 'vscode-debugprotocol';
Expand Down Expand Up @@ -31,7 +31,6 @@ export class ChromeDebugAdapter extends CoreDebugAdapter {
}

public launch(args: ILaunchRequestArgs): Promise<void> {
args.sourceMapPathOverrides = getSourceMapPathOverrides(args.webRoot, args.sourceMapPathOverrides);
return super.launch(args).then(() => {
// Check exists?
const chromePath = args.runtimeExecutable || utils.getBrowserPath();
Expand Down Expand Up @@ -81,10 +80,16 @@ export class ChromeDebugAdapter extends CoreDebugAdapter {
}

public attach(args: IAttachRequestArgs): Promise<void> {
args.sourceMapPathOverrides = getSourceMapPathOverrides(args.webRoot, args.sourceMapPathOverrides);
return super.attach(args);
}

public commonArgs(args: ICommonRequestArgs): void {
args.sourceMapPathOverrides = getSourceMapPathOverrides(args.webRoot, args.sourceMapPathOverrides);
args.skipFileRegExps = ['^chrome-extension:.*'];

super.commonArgs(args);
}

protected doAttach(port: number, targetUrl?: string, address?: string, timeout?: number): Promise<void> {
return super.doAttach(port, targetUrl, address, timeout).then(() => {
// Don't return this promise, a failure shouldn't fail attach
Expand Down

0 comments on commit c3b05bd

Please sign in to comment.