mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-18 07:47:23 +01:00
title - restore scoped editor service for title compute (#306699)
* title - restore scoped editor service for title compute * ccr
This commit is contained in:
@@ -55,6 +55,7 @@ import { IHoverDelegate } from '../../../../base/browser/ui/hover/hoverDelegate.
|
|||||||
import { CommandsRegistry } from '../../../../platform/commands/common/commands.js';
|
import { CommandsRegistry } from '../../../../platform/commands/common/commands.js';
|
||||||
import { safeIntl } from '../../../../base/common/date.js';
|
import { safeIntl } from '../../../../base/common/date.js';
|
||||||
import { IsCompactTitleBarContext, TitleBarVisibleContext } from '../../../common/contextkeys.js';
|
import { IsCompactTitleBarContext, TitleBarVisibleContext } from '../../../common/contextkeys.js';
|
||||||
|
import { ServiceCollection } from '../../../../platform/instantiation/common/serviceCollection.js';
|
||||||
|
|
||||||
export interface ITitleVariable {
|
export interface ITitleVariable {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
@@ -292,6 +293,8 @@ export class BrowserTitlebarPart extends Part implements ITitlebarPart {
|
|||||||
|
|
||||||
private readonly windowTitle: WindowTitle;
|
private readonly windowTitle: WindowTitle;
|
||||||
|
|
||||||
|
protected readonly instantiationService: IInstantiationService;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
id: string,
|
id: string,
|
||||||
targetWindow: CodeWindow,
|
targetWindow: CodeWindow,
|
||||||
@@ -299,25 +302,30 @@ export class BrowserTitlebarPart extends Part implements ITitlebarPart {
|
|||||||
@IContextMenuService private readonly contextMenuService: IContextMenuService,
|
@IContextMenuService private readonly contextMenuService: IContextMenuService,
|
||||||
@IConfigurationService protected readonly configurationService: IConfigurationService,
|
@IConfigurationService protected readonly configurationService: IConfigurationService,
|
||||||
@IBrowserWorkbenchEnvironmentService protected readonly environmentService: IBrowserWorkbenchEnvironmentService,
|
@IBrowserWorkbenchEnvironmentService protected readonly environmentService: IBrowserWorkbenchEnvironmentService,
|
||||||
@IInstantiationService protected readonly instantiationService: IInstantiationService,
|
@IInstantiationService instantiationService: IInstantiationService,
|
||||||
@IThemeService themeService: IThemeService,
|
@IThemeService themeService: IThemeService,
|
||||||
@IStorageService private readonly storageService: IStorageService,
|
@IStorageService private readonly storageService: IStorageService,
|
||||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||||
@IContextKeyService protected readonly contextKeyService: IContextKeyService,
|
@IContextKeyService protected readonly contextKeyService: IContextKeyService,
|
||||||
@IHostService private readonly hostService: IHostService,
|
@IHostService private readonly hostService: IHostService,
|
||||||
@IEditorService private readonly editorService: IEditorService,
|
@IEditorService editorService: IEditorService,
|
||||||
@IMenuService private readonly menuService: IMenuService,
|
@IMenuService private readonly menuService: IMenuService,
|
||||||
@IKeybindingService private readonly keybindingService: IKeybindingService
|
@IKeybindingService private readonly keybindingService: IKeybindingService
|
||||||
) {
|
) {
|
||||||
super(id, { hasTitle: false }, themeService, storageService, layoutService);
|
super(id, { hasTitle: false }, themeService, storageService, layoutService);
|
||||||
|
|
||||||
|
const scopedEditorService = editorService.createScoped(editorGroupsContainer, this._store);
|
||||||
|
this.instantiationService = this._register(instantiationService.createChild(new ServiceCollection(
|
||||||
|
[IEditorService, scopedEditorService]
|
||||||
|
)));
|
||||||
|
|
||||||
this.isAuxiliary = targetWindow.vscodeWindowId !== mainWindow.vscodeWindowId;
|
this.isAuxiliary = targetWindow.vscodeWindowId !== mainWindow.vscodeWindowId;
|
||||||
|
|
||||||
this.isCompactContextKey = IsCompactTitleBarContext.bindTo(this.contextKeyService);
|
this.isCompactContextKey = IsCompactTitleBarContext.bindTo(this.contextKeyService);
|
||||||
|
|
||||||
this.titleBarStyle = getTitleBarStyle(this.configurationService);
|
this.titleBarStyle = getTitleBarStyle(this.configurationService);
|
||||||
|
|
||||||
this.windowTitle = this._register(instantiationService.createInstance(WindowTitle, targetWindow));
|
this.windowTitle = this._register(this.instantiationService.createInstance(WindowTitle, targetWindow));
|
||||||
|
|
||||||
this.hoverDelegate = this._register(createInstantHoverDelegate());
|
this.hoverDelegate = this._register(createInstantHoverDelegate());
|
||||||
|
|
||||||
@@ -713,7 +721,7 @@ export class BrowserTitlebarPart extends Part implements ITitlebarPart {
|
|||||||
|
|
||||||
// The editor toolbar menu is handled by the editor group so we do not need to manage it here.
|
// The editor toolbar menu is handled by the editor group so we do not need to manage it here.
|
||||||
// However, depending on the active editor, we need to update the context and action runner of the toolbar menu.
|
// However, depending on the active editor, we need to update the context and action runner of the toolbar menu.
|
||||||
if (this.editorActionsEnabled && this.editorService.activeEditor !== undefined) {
|
if (this.editorActionsEnabled && this.editorGroupsContainer.activeGroup?.activeEditor) {
|
||||||
const context: IEditorCommandsContext = { groupId: this.editorGroupsContainer.activeGroup.id };
|
const context: IEditorCommandsContext = { groupId: this.editorGroupsContainer.activeGroup.id };
|
||||||
|
|
||||||
this.actionToolBar.actionRunner = this.editorToolbarMenuDisposables.add(new EditorCommandsContextActionRunner(context));
|
this.actionToolBar.actionRunner = this.editorToolbarMenuDisposables.add(new EditorCommandsContextActionRunner(context));
|
||||||
|
|||||||
Reference in New Issue
Block a user