Skip to content

Commit 70b6f95

Browse files
authored
aux window - scope editor service in title bar (#198450)
1 parent 87e7f8b commit 70b6f95

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/vs/workbench/browser/parts/titlebar/titlebarPart.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ export class TitlebarPart extends Part implements ITitleService {
109109

110110
private readonly windowTitle: WindowTitle;
111111

112+
private readonly editorService: IEditorService;
113+
112114
constructor(
113115
@IContextMenuService private readonly contextMenuService: IContextMenuService,
114116
@IConfigurationService protected readonly configurationService: IConfigurationService,
@@ -121,12 +123,13 @@ export class TitlebarPart extends Part implements ITitleService {
121123
@IHostService private readonly hostService: IHostService,
122124
@IHoverService hoverService: IHoverService,
123125
@IEditorGroupsService private editorGroupService: IEditorGroupsService,
124-
@IEditorService private editorService: IEditorService,
126+
@IEditorService editorService: IEditorService,
125127
@IMenuService private readonly menuService: IMenuService,
126128
@IKeybindingService private readonly keybindingService: IKeybindingService,
127129
) {
128130
super(Parts.TITLEBAR_PART, { hasTitle: false }, themeService, storageService, layoutService);
129131
this.windowTitle = this._register(instantiationService.createInstance(WindowTitle, mainWindow, 'main'));
132+
this.editorService = editorService.createScoped('main', this._store);
130133

131134
this.titleBarStyle = getTitleBarStyle(this.configurationService);
132135

@@ -371,7 +374,7 @@ export class TitlebarPart extends Part implements ITitleService {
371374
}
372375

373376
// --- Editor Actions
374-
const activeEditorPane = this.editorGroupService.activeGroup?.activeEditorPane;
377+
const activeEditorPane = this.editorGroupService.mainPart.activeGroup?.activeEditorPane;
375378
if (activeEditorPane && activeEditorPane instanceof EditorPane) {
376379
const result = activeEditorPane.getActionViewItem(action);
377380

@@ -385,7 +388,7 @@ export class TitlebarPart extends Part implements ITitleService {
385388
}
386389

387390
protected getKeybinding(action: IAction): ResolvedKeybinding | undefined {
388-
const editorPaneAwareContextKeyService = this.editorGroupService.activeGroup?.activeEditorPane?.scopedContextKeyService ?? this.contextKeyService;
391+
const editorPaneAwareContextKeyService = this.editorGroupService.mainPart.activeGroup?.activeEditorPane?.scopedContextKeyService ?? this.contextKeyService;
389392
return this.keybindingService.lookupKeybinding(action.id, editorPaneAwareContextKeyService);
390393
}
391394

@@ -410,7 +413,7 @@ export class TitlebarPart extends Part implements ITitleService {
410413
this.actionToolBarDisposable.add(this.actionToolBar);
411414

412415
if (this.editorActionsEnabled) {
413-
this.actionToolBarDisposable.add(this.editorGroupService.onDidChangeActiveGroup(() => this.createActionToolBarMenus({ editorActions: true })));
416+
this.actionToolBarDisposable.add(this.editorGroupService.mainPart.onDidChangeActiveGroup(() => this.createActionToolBarMenus({ editorActions: true })));
414417
}
415418
}
416419

@@ -426,7 +429,7 @@ export class TitlebarPart extends Part implements ITitleService {
426429
if (this.editorActionsEnabled) {
427430
this.editorActionsChangeDisposable.clear();
428431

429-
const activeGroup = this.editorGroupService.activeGroup;
432+
const activeGroup = this.editorGroupService.mainPart.activeGroup;
430433
if (activeGroup) { // Can be undefined on startup
431434
const editorActions = activeGroup.createEditorActions(this.editorActionsChangeDisposable);
432435

@@ -464,7 +467,7 @@ export class TitlebarPart extends Part implements ITitleService {
464467
// The editor toolbar menu is handled by the editor group so we do not need to manage it here.
465468
// However, depending on the active editor, we need to update the context and action runner of the toolbar menu.
466469
if (this.editorActionsEnabled && this.editorService.activeEditor !== undefined) {
467-
const context: IEditorCommandsContext = { groupId: this.editorGroupService.activeGroup.id };
470+
const context: IEditorCommandsContext = { groupId: this.editorGroupService.mainPart.activeGroup.id };
468471

469472
this.actionToolBar.actionRunner = new EditorCommandsContextActionRunner(context);
470473
this.actionToolBar.context = context;

0 commit comments

Comments
 (0)