Skip to content

Commit 8e89400

Browse files
committed
debug: on restart only read out the launch.json if it was changed
microsoft#28175
1 parent 6c0d720 commit 8e89400

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

src/vs/workbench/parts/debug/electron-browser/debugService.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export class DebugService implements debug.IDebugService {
8181
private debugState: IContextKey<string>;
8282
private breakpointsToSendOnResourceSaved: Set<string>;
8383
private callStackScheduler: RunOnceScheduler;
84+
private launchJsonChanged: boolean;
8485

8586
constructor(
8687
@IStorageService private storageService: IStorageService,
@@ -628,6 +629,7 @@ export class DebugService implements debug.IDebugService {
628629
if (this.model.getProcesses().length === 0) {
629630
this.removeReplExpressions();
630631
}
632+
this.launchJsonChanged = false;
631633
const manager = this.getConfigurationManager();
632634
configName = configName || this.viewModel.selectedConfigurationName;
633635
const config = manager.getConfiguration(configName);
@@ -921,15 +923,19 @@ export class DebugService implements debug.IDebugService {
921923
return process.session.disconnect(true).then(() =>
922924
new TPromise<void>((c, e) => {
923925
setTimeout(() => {
924-
// Read the configuration again if a launch.json exists, if not just use the inmemory configuration #19366
925-
const config = this.configurationManager.getConfiguration(process.configuration.name);
926-
if (config) {
927-
// Take the type from the process since the debug extension might overwrite it #21316
928-
config.type = process.configuration.type;
929-
config.noDebug = process.configuration.noDebug;
930-
config.__restart = restartData;
926+
// Read the configuration again if a launch.json has been changed, if not just use the inmemory configuration
927+
let config = process.configuration;
928+
if (this.launchJsonChanged) {
929+
this.launchJsonChanged = false;
930+
config = this.configurationManager.getConfiguration(process.configuration.name) || process.configuration;
931+
if (config) {
932+
// Take the type from the process since the debug extension might overwrite it #21316
933+
config.type = process.configuration.type;
934+
config.noDebug = process.configuration.noDebug;
935+
config.__restart = restartData;
936+
}
931937
}
932-
this.createProcess(config || process.configuration).then(() => c(null), err => e(err));
938+
this.createProcess(config).then(() => c(null), err => e(err));
933939
}, 300);
934940
})
935941
).then(() => {
@@ -1115,6 +1121,9 @@ export class DebugService implements debug.IDebugService {
11151121
this.breakpointsToSendOnResourceSaved.delete(event.resource.toString());
11161122
this.sendBreakpoints(event.resource, true).done(null, errors.onUnexpectedError);
11171123
}
1124+
if (event.resource.toString().indexOf('.vscode/launch.json') >= 0) {
1125+
this.launchJsonChanged = true;
1126+
}
11181127
});
11191128
}
11201129

0 commit comments

Comments
 (0)