Skip to content

Commit 7f79730

Browse files
committed
Revert "Run menu does not remember dynamic launch configurations"
This reverts commit d4248f3.
1 parent 747d667 commit 7f79730

1 file changed

Lines changed: 7 additions & 21 deletions

File tree

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

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jsonRegistry.registerSchema(launchSchemaId, launchSchema);
4646

4747
const DEBUG_SELECTED_CONFIG_NAME_KEY = 'debug.selectedconfigname';
4848
const DEBUG_SELECTED_ROOT = 'debug.selectedroot';
49-
const DEBUG_SELECTED_DYNAMIC_CONFIG = 'debug.selecteddynamicconfig';
5049

5150
interface IDynamicPickItem { label: string, launch: ILaunch, config: IConfig }
5251

@@ -84,30 +83,23 @@ export class ConfigurationManager implements IConfigurationManager {
8483
this.toDispose = [];
8584
this.initLaunches();
8685
this.registerListeners();
86+
const previousSelectedRoot = this.storageService.get(DEBUG_SELECTED_ROOT, StorageScope.WORKSPACE);
87+
const previousSelectedLaunch = this.launches.find(l => l.uri.toString() === previousSelectedRoot);
8788
this.debugConfigurationTypeContext = CONTEXT_DEBUG_CONFIGURATION_TYPE.bindTo(contextKeyService);
8889
this.debuggersAvailable = CONTEXT_DEBUGGERS_AVAILABLE.bindTo(contextKeyService);
89-
90+
if (previousSelectedLaunch && previousSelectedLaunch.getConfigurationNames().length) {
91+
this.selectConfiguration(previousSelectedLaunch, this.storageService.get(DEBUG_SELECTED_CONFIG_NAME_KEY, StorageScope.WORKSPACE));
92+
} else if (this.launches.length > 0) {
93+
this.selectConfiguration(undefined);
94+
}
9095
}
9196

9297
// debuggers
9398

9499
registerDebugAdapterFactory(debugTypes: string[], debugAdapterLauncher: IDebugAdapterFactory): IDisposable {
95-
const firstRegistration = this.debugAdapterFactories.size === 0;
96100
debugTypes.forEach(debugType => this.debugAdapterFactories.set(debugType, debugAdapterLauncher));
97101
this.debuggersAvailable.set(this.debugAdapterFactories.size > 0);
98102
this._onDidRegisterDebugger.fire();
99-
if (firstRegistration) {
100-
const previousSelectedRoot = this.storageService.get(DEBUG_SELECTED_ROOT, StorageScope.WORKSPACE);
101-
const previousSelectedLaunch = this.launches.find(l => l.uri.toString() === previousSelectedRoot);
102-
if (previousSelectedLaunch && previousSelectedLaunch.getConfigurationNames().length) {
103-
const name = this.storageService.get(DEBUG_SELECTED_CONFIG_NAME_KEY, StorageScope.WORKSPACE);
104-
const configStr = this.storageService.get(DEBUG_SELECTED_DYNAMIC_CONFIG, StorageScope.WORKSPACE);
105-
const config = configStr ? JSON.parse(configStr) : undefined;
106-
this.selectConfiguration(previousSelectedLaunch, name, config);
107-
} else if (this.launches.length > 0) {
108-
this.selectConfiguration(undefined);
109-
}
110-
}
111103

112104
return {
113105
dispose: () => {
@@ -542,12 +534,6 @@ export class ConfigurationManager implements IConfigurationManager {
542534
}
543535

544536
this.selectedConfig = config;
545-
if (config) {
546-
// Only dynamic configurations get passed in the selectConfiguration. We should store them #96293
547-
this.storageService.store(DEBUG_SELECTED_DYNAMIC_CONFIG, JSON.stringify(config), StorageScope.WORKSPACE);
548-
} else {
549-
this.storageService.remove(DEBUG_SELECTED_DYNAMIC_CONFIG, StorageScope.WORKSPACE);
550-
}
551537
const configForType = this.selectedConfig || (this.selectedLaunch && this.selectedName ? this.selectedLaunch.getConfiguration(this.selectedName) : undefined);
552538
if (configForType) {
553539
this.debugConfigurationTypeContext.set(configForType.type);

0 commit comments

Comments
 (0)