Skip to content

Commit 5864b1f

Browse files
authored
VS Code pre-release does not reload code on restart of the debugger (microsoft#157948)
* VS Code pre-release does not reload code on restart of the debugger Fixes microsoft#157655
1 parent a17fb44 commit 5864b1f

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

src/vs/workbench/api/browser/mainThreadDebugService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
232232
compact: options.compact,
233233
debugUI: options.debugUI,
234234
compoundRoot: parentSession?.compoundRoot,
235-
saveBeforeStart: saveBeforeStart
235+
saveBeforeRestart: saveBeforeStart
236236
};
237237
try {
238-
return this.debugService.startDebugging(launch, nameOrConfig, debugOptions);
238+
return this.debugService.startDebugging(launch, nameOrConfig, debugOptions, saveBeforeStart);
239239
} catch (err) {
240240
throw new ErrorNoTelemetry(err && err.message ? err.message : 'cannot start debugging');
241241
}

src/vs/workbench/contrib/debug/browser/debugCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
731731
const { launch, name, getConfig } = debugService.getConfigurationManager().selectedConfiguration;
732732
const config = await getConfig();
733733
const configOrName = config ? Object.assign(deepClone(config), debugStartOptions?.config) : name;
734-
await debugService.startDebugging(launch, configOrName, { noDebug: debugStartOptions?.noDebug, startedByUser: true, saveBeforeStart: false });
734+
await debugService.startDebugging(launch, configOrName, { noDebug: debugStartOptions?.noDebug, startedByUser: true }, false);
735735
}
736736
});
737737

src/vs/workbench/contrib/debug/browser/debugService.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,7 @@ export class DebugService implements IDebugService {
310310
* main entry point
311311
* properly manages compounds, checks for errors and handles the initializing state.
312312
*/
313-
async startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, options?: IDebugSessionOptions): Promise<boolean> {
314-
315-
const saveBeforeStart = options?.saveBeforeStart ?? !options?.parentSession;
316-
313+
async startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, options?: IDebugSessionOptions, saveBeforeStart = !options?.parentSession): Promise<boolean> {
317314
const message = options && options.noDebug ? nls.localize('runTrust', "Running executes build tasks and program code from your workspace.") : nls.localize('debugTrust', "Debugging executes build tasks and program code from your workspace.");
318315
const trust = await this.workspaceTrustRequestService.requestWorkspaceTrust({ message });
319316
if (!trust) {
@@ -702,7 +699,7 @@ export class DebugService implements IDebugService {
702699
}
703700

704701
async restartSession(session: IDebugSession, restartData?: any): Promise<any> {
705-
if (session.saveBeforeStart) {
702+
if (session.saveBeforeRestart) {
706703
await saveAllBeforeDebugStart(this.configurationService, this.editorService);
707704
}
708705

src/vs/workbench/contrib/debug/browser/debugSession.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ export class DebugSession implements IDebugSession {
164164
return !!this._options.compact;
165165
}
166166

167-
get saveBeforeStart(): boolean {
168-
return this._options.saveBeforeStart ?? !this._options?.parentSession;
167+
get saveBeforeRestart(): boolean {
168+
return this._options.saveBeforeRestart ?? !this._options?.parentSession;
169169
}
170170

171171
get compoundRoot(): DebugCompoundRoot | undefined {

src/vs/workbench/contrib/debug/common/debug.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export interface IDebugSessionOptions {
206206
simple?: boolean;
207207
};
208208
startedByUser?: boolean;
209-
saveBeforeStart?: boolean;
209+
saveBeforeRestart?: boolean;
210210
}
211211

212212
export interface IDataBreakpointInfoResponse {
@@ -297,7 +297,7 @@ export interface IDebugSession extends ITreeElement {
297297
readonly subId: string | undefined;
298298
readonly compact: boolean;
299299
readonly compoundRoot: DebugCompoundRoot | undefined;
300-
readonly saveBeforeStart: boolean;
300+
readonly saveBeforeRestart: boolean;
301301
readonly name: string;
302302
readonly isSimpleUI: boolean;
303303
readonly autoExpandLazyVariables: boolean;
@@ -1091,7 +1091,7 @@ export interface IDebugService {
10911091
* Returns true if the start debugging was successful. For compound launches, all configurations have to start successfully for it to return success.
10921092
* On errors the startDebugging will throw an error, however some error and cancelations are handled and in that case will simply return false.
10931093
*/
1094-
startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, options?: IDebugSessionOptions): Promise<boolean>;
1094+
startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, options?: IDebugSessionOptions, saveBeforeStart?: boolean): Promise<boolean>;
10951095

10961096
/**
10971097
* Restarts a session or creates a new one if there is no active session.

src/vs/workbench/contrib/debug/test/browser/mockDebug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export class MockSession implements IDebugSession {
190190
return undefined;
191191
}
192192

193-
get saveBeforeStart(): boolean {
193+
get saveBeforeRestart(): boolean {
194194
return true;
195195
}
196196

0 commit comments

Comments
 (0)