In case the debug toolbar is docked we need to make sure that the docked toolbar has the up to date commands registered
fixes #115945
This commit is contained in:
parent
ec19e508a6
commit
7cd055cdce
1 changed files with 17 additions and 2 deletions
|
@ -257,6 +257,7 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
|
|||
|
||||
// Debug toolbar
|
||||
|
||||
let debugViewTitleItems: IDisposable[] = [];
|
||||
const registerDebugToolBarItem = (id: string, title: string, order: number, icon?: { light?: URI, dark?: URI } | ThemeIcon, when?: ContextKeyExpression, precondition?: ContextKeyExpression, alt?: ICommandAction) => {
|
||||
MenuRegistry.appendMenuItem(MenuId.DebugToolBar, {
|
||||
group: 'navigation',
|
||||
|
@ -272,7 +273,7 @@ const registerDebugToolBarItem = (id: string, title: string, order: number, icon
|
|||
});
|
||||
|
||||
// Register actions in debug viewlet when toolbar is docked
|
||||
MenuRegistry.appendMenuItem(MenuId.ViewContainerTitle, {
|
||||
debugViewTitleItems.push(MenuRegistry.appendMenuItem(MenuId.ViewContainerTitle, {
|
||||
group: 'navigation',
|
||||
when: ContextKeyExpr.and(when, ContextKeyEqualsExpr.create('viewContainer', VIEWLET_ID), CONTEXT_DEBUG_STATE.notEqualsTo('inactive'), ContextKeyExpr.equals('config.debug.toolBarLocation', 'docked')),
|
||||
order,
|
||||
|
@ -282,9 +283,23 @@ const registerDebugToolBarItem = (id: string, title: string, order: number, icon
|
|||
icon,
|
||||
precondition
|
||||
}
|
||||
});
|
||||
}));
|
||||
};
|
||||
|
||||
MenuRegistry.onDidChangeMenu(e => {
|
||||
// In case the debug toolbar is docked we need to make sure that the docked toolbar has the up to date commands registered #115945
|
||||
if (e.has(MenuId.DebugToolBar)) {
|
||||
dispose(debugViewTitleItems);
|
||||
const items = MenuRegistry.getMenuItems(MenuId.DebugToolBar);
|
||||
for (const i of items) {
|
||||
debugViewTitleItems.push(MenuRegistry.appendMenuItem(MenuId.ViewContainerTitle, {
|
||||
...i,
|
||||
when: ContextKeyExpr.and(i.when, ContextKeyEqualsExpr.create('viewContainer', VIEWLET_ID), CONTEXT_DEBUG_STATE.notEqualsTo('inactive'), ContextKeyExpr.equals('config.debug.toolBarLocation', 'docked'))
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
registerDebugToolBarItem(CONTINUE_ID, CONTINUE_LABEL, 10, icons.debugContinue, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
|
||||
registerDebugToolBarItem(PAUSE_ID, PAUSE_LABEL, 10, icons.debugPause, CONTEXT_DEBUG_STATE.notEqualsTo('stopped'), CONTEXT_DEBUG_STATE.isEqualTo('running'));
|
||||
registerDebugToolBarItem(STOP_ID, STOP_LABEL, 70, icons.debugStop, CONTEXT_FOCUSED_SESSION_IS_ATTACH.toNegated(), undefined, { id: DISCONNECT_ID, title: DISCONNECT_LABEL, icon: icons.debugDisconnect });
|
||||
|
|
Loading…
Reference in a new issue