Skip to content

Commit

Permalink
fixes #96293
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Oct 1, 2020
1 parent 14788f2 commit 3565fba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ export class StartDebugActionViewItem implements IActionViewItem {
}

this.providers.forEach(p => {
if (p.provider && p.provider.type === manager.selectedConfiguration.config?.type) {
if (p.provider && p.provider.type === manager.selectedConfiguration.type) {
this.selected = this.options.length;
}

this.options.push({
label: `${p.label}...`, handler: async () => {
const picked = await p.pick();
if (picked) {
await manager.selectConfiguration(picked.launch, picked.config.name, picked.config);
await manager.selectConfiguration(picked.launch, picked.config.name, picked.config, p.provider?.type);
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class ConfigurationManager implements IConfigurationManager {
private selectedName: string | undefined;
private selectedLaunch: ILaunch | undefined;
private selectedConfig: IConfig | undefined;
private selectedType: string | undefined;
private toDispose: IDisposable[];
private readonly _onDidSelectConfigurationName = new Emitter<void>();
private configProviders: IDebugConfigurationProvider[];
Expand Down Expand Up @@ -493,11 +494,12 @@ export class ConfigurationManager implements IConfigurationManager {
return this.launches.find(l => l.workspace && l.workspace.uri.toString() === workspaceUri.toString());
}

get selectedConfiguration(): { launch: ILaunch | undefined, name: string | undefined, config: IConfig | undefined } {
get selectedConfiguration(): { launch: ILaunch | undefined, name: string | undefined, config: IConfig | undefined, type: string | undefined } {
return {
launch: this.selectedLaunch,
name: this.selectedName,
config: this.selectedConfig
config: this.selectedConfig,
type: this.selectedType
};
}

Expand Down Expand Up @@ -555,7 +557,8 @@ export class ConfigurationManager implements IConfigurationManager {
}

this.selectedConfig = config;
this.storageService.store(DEBUG_SELECTED_TYPE, this.selectedConfig?.type, StorageScope.WORKSPACE);
this.selectedType = type || this.selectedConfig?.type;
this.storageService.store(DEBUG_SELECTED_TYPE, this.selectedType, StorageScope.WORKSPACE);
const configForType = this.selectedConfig || (this.selectedLaunch && this.selectedName ? this.selectedLaunch.getConfiguration(this.selectedName) : undefined);
if (configForType) {
this.debugConfigurationTypeContext.set(configForType.type);
Expand Down
4 changes: 3 additions & 1 deletion src/vs/workbench/contrib/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,11 @@ export interface IConfigurationManager {
launch: ILaunch | undefined;
config: IConfig | undefined;
name: string | undefined;
// Type is used when matching dynamic configurations to their corresponding provider
type: string | undefined;
};

selectConfiguration(launch: ILaunch | undefined, name?: string, config?: IConfig): Promise<void>;
selectConfiguration(launch: ILaunch | undefined, name?: string, config?: IConfig, type?: string): Promise<void>;

getLaunches(): ReadonlyArray<ILaunch>;

Expand Down

0 comments on commit 3565fba

Please sign in to comment.