提交 caf50ae5 编写于 作者: I isidor

debug viewlet: better update of the docked toolbar

fixes #103463
上级 ef126294
......@@ -30,6 +30,7 @@ import { MenuEntryActionViewItem, SubmenuEntryActionViewItem } from 'vs/platform
import { IViewDescriptorService, IViewsService } from 'vs/workbench/common/views';
import { WelcomeView } from 'vs/workbench/contrib/debug/browser/welcomeView';
import { ToggleViewAction } from 'vs/workbench/browser/actions/layoutActions';
import { RunOnceScheduler } from 'vs/base/common/async';
export class DebugViewPaneContainer extends ViewPaneContainer {
......@@ -39,6 +40,7 @@ export class DebugViewPaneContainer extends ViewPaneContainer {
private paneListeners = new Map<string, IDisposable>();
private debugToolBarMenu: IMenu | undefined;
private disposeOnTitleUpdate: IDisposable | undefined;
private updateToolBarScheduler: RunOnceScheduler;
constructor(
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
......@@ -59,8 +61,17 @@ export class DebugViewPaneContainer extends ViewPaneContainer {
) {
super(VIEWLET_ID, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService, viewDescriptorService);
this.updateToolBarScheduler = this._register(new RunOnceScheduler(() => {
if (this.configurationService.getValue<IDebugConfiguration>('debug').toolBarLocation === 'docked') {
this.updateTitleArea();
}
}, 20));
// When there are potential updates to the docked debug toolbar we need to update it
this._register(this.debugService.onDidChangeState(state => this.onDebugServiceStateChange(state)));
this._register(this.debugService.onDidNewSession(() => this.updateToolBar()));
this._register(this.debugService.onDidNewSession(() => this.updateToolBarScheduler.schedule()));
this._register(this.debugService.getViewModel().onDidFocusSession(() => this.updateToolBarScheduler.schedule()));
this._register(this.contextKeyService.onDidChangeContext(e => {
if (e.affectsSome(new Set([CONTEXT_DEBUG_UX_KEY]))) {
this.updateTitleArea();
......@@ -120,6 +131,7 @@ export class DebugViewPaneContainer extends ViewPaneContainer {
if (!this.debugToolBarMenu) {
this.debugToolBarMenu = this.menuService.createMenu(MenuId.DebugToolBar, this.contextKeyService);
this._register(this.debugToolBarMenu);
this._register(this.debugToolBarMenu.onDidChange(() => this.updateToolBarScheduler.schedule()));
}
const { actions, disposable } = DebugToolBar.getActions(this.debugToolBarMenu, this.debugService, this.instantiationService);
......@@ -187,13 +199,7 @@ export class DebugViewPaneContainer extends ViewPaneContainer {
});
}
this.updateToolBar();
}
private updateToolBar(): void {
if (this.configurationService.getValue<IDebugConfiguration>('debug').toolBarLocation === 'docked') {
this.updateTitleArea();
}
this.updateToolBarScheduler.schedule();
}
addPanes(panes: { pane: ViewPane, size: number, index?: number }[]): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册