Skip to content

Commit aeb21f0

Browse files
Provide an opt-out for debug entrypoint resolution (#2349)
1 parent 496a6f1 commit aeb21f0

4 files changed

Lines changed: 15 additions & 1 deletion

File tree

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"configuration.terminalOptions": "Default launch options for the JavaScript debug terminal and npm scripts.",
7777
"configuration.unmapMissingSources": "Configures whether sourcemapped file where the original file can't be read will automatically be unmapped. If this is false (default), a prompt is shown.",
7878
"configuration.enableNetworkView": "Enables the experimental network view for targets that support it.",
79+
"configuration.resolveDebugEntrypoint": "When true (default), js-debug uses source maps to remap a non-`.js` `program` path to its compiled output before launching. Set to false to execute the `program` path exactly as written.",
7980
"createDiagnostics.label": "Diagnose Breakpoint Problems",
8081
"customDescriptionGenerator.description": "Customize the textual description the debugger shows for objects (local variables, etc...). Samples:\n 1. this.toString() // will call toString to print all objects\n 2. this.customDescription ? this.customDescription() : defaultValue // Use customDescription method if available, if not return defaultValue\n 3. function (def) { return this.customDescription ? this.customDescription() : def } // Use customDescription method if available, if not return defaultValue\n ",
8182
"customPropertiesGenerator.description": "Customize the properties shown for an object in the debugger (local variables, etc...). Samples:\n 1. { ...this, extraProperty: '12345' } // Add an extraProperty 12345 to all objects\n 2. this.customProperties ? this.customProperties() : this // Use customProperties method if available, if not use the properties in this (the default properties)\n 3. function () { return this.customProperties ? this.customProperties() : this } // Use customDescription method if available, if not return the default properties\n\n Deprecated: This is a temporary implementation of this feature until we have time to implement it in the way described here: https://github.com/microsoft/vscode/issues/102181",

src/build/generate-contributions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,6 +1328,11 @@ const configurationSchema: ConfigurationAttributes<IConfigurationTypes> = {
13281328
default: true,
13291329
description: refString('configuration.enableNetworkView'),
13301330
},
1331+
[Configuration.ResolveDebugEntrypoint]: {
1332+
type: 'boolean',
1333+
default: true,
1334+
markdownDescription: refString('configuration.resolveDebugEntrypoint'),
1335+
},
13311336
};
13321337

13331338
const commands: ReadonlyArray<{

src/common/contributionUtils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export const enum Configuration {
181181
DefaultRuntimeExecutables = 'debug.javascript.defaultRuntimeExecutable',
182182
ResourceRequestOptions = 'debug.javascript.resourceRequestOptions',
183183
EnableNetworkView = 'debug.javascript.enableNetworkView',
184+
ResolveDebugEntrypoint = 'debug.javascript.resolveDebugEntrypoint',
184185
}
185186

186187
export type DebugByLinkState = 'on' | 'off' | 'always';
@@ -203,6 +204,7 @@ export interface IConfigurationTypes {
203204
[Configuration.DefaultRuntimeExecutables]: { [K in DebugType]?: string };
204205
[Configuration.ResourceRequestOptions]: Partial<OptionsOfBufferResponseBody>;
205206
[Configuration.EnableNetworkView]: boolean;
207+
[Configuration.ResolveDebugEntrypoint]: boolean;
206208
}
207209

208210
export interface IStackFrameContext {

src/targets/node/nodeLauncher.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
import { inject, injectable, multiInject } from 'inversify';
66
import { extname, resolve } from 'path';
7+
import * as vscode from 'vscode';
78
import { IBreakpointsPredictor } from '../../adapter/breakpointPredictor';
89
import { IPortLeaseTracker } from '../../adapter/portLeaseTracker';
910
import Cdp from '../../cdp/api';
1011
import { asArray, iteratorFirst } from '../../common/arrayUtils';
11-
import { DebugType } from '../../common/contributionUtils';
12+
import { Configuration, DebugType, readConfig } from '../../common/contributionUtils';
1213
import { IFsUtils, LocalFsUtils } from '../../common/fsUtils';
1314
import { ILogger, LogTag } from '../../common/logging';
1415
import { fixDriveLetterAndSlashes } from '../../common/pathUtils';
@@ -312,6 +313,11 @@ export class NodeLauncher extends NodeLauncherBase<INodeLaunchConfiguration> {
312313
return targetProgram;
313314
}
314315

316+
const resolve = readConfig(vscode.workspace, Configuration.ResolveDebugEntrypoint);
317+
if (!resolve) {
318+
return targetProgram;
319+
}
320+
315321
const mapped = await this.bpPredictor.getPredictionForSource(targetProgram);
316322
if (!mapped || mapped.size === 0) {
317323
return targetProgram;

0 commit comments

Comments
 (0)