Skip to content

Commit

Permalink
fix: node internals not skipping on Node 15
Browse files Browse the repository at this point in the history
Fixes #862
  • Loading branch information
connor4312 committed Nov 23, 2020
1 parent e14d78f commit 4a8f2b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he
- fix: don't show quick pick when there is only a single npm script ([#851](https://github.com/microsoft/vscode-js-debug/issues/851))
- fix: don't narrow outfiles on any remoteRoot ([#854](https://github.com/microsoft/vscode-js-debug/issues/854))
- fix: more thoroughly clean VS Code-specific environment variables from launch ([#64897](https://github.com/microsoft/vscode/issues/64897), [#38428](https://github.com/microsoft/vscode/issues/38428))
- fix: node internals not skipping on Node 15 ([#862](https://github.com/microsoft/vscode-js-debug/issues/862))

## v1.51.0 - 2020-10-26

Expand Down
16 changes: 13 additions & 3 deletions src/adapter/scriptSkipper/implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ interface ISharedSkipToggleEvent {
params: Dap.ToggleSkipFileStatusParams;
}

const node15InternalsPrefix = 'node:';

@injectable()
export class ScriptSkipper {
private static sharedSkipsEmitter = new EventEmitter<ISharedSkipToggleEvent>();
Expand Down Expand Up @@ -117,11 +119,15 @@ export class ScriptSkipper {
}

private _testSkipNodeInternal(testString: string): boolean {
if (this._nodeInternalsGlobs) {
return micromatch([testString], this._nodeInternalsGlobs).length > 0;
if (!this._nodeInternalsGlobs) {
return false;
}

return false;
if (testString.startsWith(node15InternalsPrefix)) {
testString = testString.slice(node15InternalsPrefix.length);
}

return micromatch([testString], this._nodeInternalsGlobs).length > 0;
}

private _testSkipNonNodeInternal(testString: string): boolean {
Expand All @@ -137,6 +143,10 @@ export class ScriptSkipper {
}

private _isNodeInternal(url: string, nodeInternals: ReadonlySet<string> | undefined): boolean {
if (url.startsWith(node15InternalsPrefix)) {
return true;
}

return nodeInternals?.has(url) || /^internal\/.+\.js$/.test(url);
}

Expand Down

0 comments on commit 4a8f2b6

Please sign in to comment.