From 04c805a943731c0d6da6e024637d2cadbb82ca36 Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 20 Dec 2019 15:10:12 +0100 Subject: [PATCH] debug select make sure all separators are disabled --- .../workbench/contrib/debug/browser/debugActionViewItems.ts | 6 ++++-- src/vs/workbench/contrib/output/browser/outputActions.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts b/src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts index c48efd1ee95..767b547b64f 100644 --- a/src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts +++ b/src/vs/workbench/contrib/debug/browser/debugActionViewItems.ts @@ -159,6 +159,7 @@ export class StartDebugActionViewItem implements IActionViewItem { const manager = this.debugService.getConfigurationManager(); const inWorkspace = this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE; let lastGroup: string | undefined; + const disabledIdxs: number[] = []; manager.getAllConfigurations().forEach(({ launch, name, presentation }) => { if (name === manager.selectedConfiguration.name && launch === manager.selectedConfiguration.launch) { this.selected = this.options.length; @@ -167,6 +168,7 @@ export class StartDebugActionViewItem implements IActionViewItem { lastGroup = presentation?.group; if (this.options.length) { this.options.push({ label: StartDebugActionViewItem.SEPARATOR, handler: undefined }); + disabledIdxs.push(this.options.length - 1); } } @@ -178,9 +180,9 @@ export class StartDebugActionViewItem implements IActionViewItem { this.options.push({ label: nls.localize('noConfigurations', "No Configurations"), handler: () => false }); } else { this.options.push({ label: StartDebugActionViewItem.SEPARATOR, handler: undefined }); + disabledIdxs.push(this.options.length - 1); } - const disabledIdx = this.options.length - 1; manager.getLaunches().filter(l => !l.hidden).forEach(l => { const label = inWorkspace ? nls.localize("addConfigTo", "Add Config ({0})...", l.name) : nls.localize('addConfiguration', "Add Configuration..."); this.options.push({ @@ -191,7 +193,7 @@ export class StartDebugActionViewItem implements IActionViewItem { }); }); - this.selectBox.setOptions(this.options.map((data, index) => { text: data.label, isDisabled: (index === disabledIdx ? true : undefined) }), this.selected); + this.selectBox.setOptions(this.options.map((data, index) => { text: data.label, isDisabled: disabledIdxs.indexOf(index) !== -1 }), this.selected); } } diff --git a/src/vs/workbench/contrib/output/browser/outputActions.ts b/src/vs/workbench/contrib/output/browser/outputActions.ts index 1d16cfea3b1..4686280ec9a 100644 --- a/src/vs/workbench/contrib/output/browser/outputActions.ts +++ b/src/vs/workbench/contrib/output/browser/outputActions.ts @@ -173,7 +173,7 @@ export class SwitchOutputActionViewItem extends SelectActionViewItem { selected = logChannelIndex !== -1 ? separatorIndex + 1 + logChannelIndex : 0; } } - this.setOptions(options.map((label, index) => { text: label, isDisabled: (index === separatorIndex ? true : undefined) }), Math.max(0, selected)); + this.setOptions(options.map((label, index) => { text: label, isDisabled: (index === separatorIndex ? true : false) }), Math.max(0, selected)); } } -- GitLab