diff --git a/src/vs/workbench/parts/debug/browser/debugActionItems.ts b/src/vs/workbench/parts/debug/browser/debugActionItems.ts index 7268ee737c928532a341f0a42922ab779cfd3758..5e9150db3c28408bd7ae4120ed0a6c20ed05e57f 100644 --- a/src/vs/workbench/parts/debug/browser/debugActionItems.ts +++ b/src/vs/workbench/parts/debug/browser/debugActionItems.ts @@ -55,10 +55,9 @@ export class FocusProcessActionItem extends SelectActionItem { ) { super(null, action, [], -1); - this.debugService.getModel().onDidChangeCallStack(() => { + this.debugService.getViewModel().onDidFocusProcess(p => { const names = this.debugService.getModel().getProcesses().map(p => p.name); - const focusedProcess = this.debugService.getViewModel().focusedProcess; - this.setOptions(names, focusedProcess ? names.indexOf(focusedProcess.name) : 0); + this.setOptions(names, p ? names.indexOf(p.name) : 0); }); } } diff --git a/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts b/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts index 0d66b72157485e90c0a8188bbbe0a24c36687343..9b0f6dce8382e8d3ddb0f44c36c4ba7bd1b62da3 100644 --- a/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts +++ b/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts @@ -64,6 +64,11 @@ export class DebugActionsWidget implements IWorkbenchContribution { orientation: ActionsOrientation.HORIZONTAL, actionItemProvider: (action: IAction) => { if (action.id === FocusProcessAction.ID) { + if (!this.focusProcessActionItem) { + this.focusProcessActionItem = this.instantiationService.createInstance(FocusProcessActionItem, action); + this.toDispose.push(this.focusProcessActionItem); + } + return this.focusProcessActionItem; } @@ -186,11 +191,7 @@ export class DebugActionsWidget implements IWorkbenchContribution { this.allActions.push(this.instantiationService.createInstance(StepOutAction, StepOutAction.ID, StepOutAction.LABEL)); this.allActions.push(this.instantiationService.createInstance(RestartAction, RestartAction.ID, RestartAction.LABEL)); this.allActions.push(this.instantiationService.createInstance(StepBackAction, StepBackAction.ID, StepBackAction.LABEL)); - const focusProcesAction = this.instantiationService.createInstance(FocusProcessAction, FocusProcessAction.ID, FocusProcessAction.LABEL); - this.allActions.push(focusProcesAction); - this.focusProcessActionItem = this.instantiationService.createInstance(FocusProcessActionItem, focusProcesAction); - - this.toDispose.push(this.focusProcessActionItem); + this.allActions.push(this.instantiationService.createInstance(FocusProcessAction, FocusProcessAction.ID, FocusProcessAction.LABEL)); this.allActions.forEach(a => { this.toDispose.push(a); });