mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
titleControl: update labels once new formater gets registered
This commit is contained in:
parent
b2e79419a2
commit
ff6ef95b2b
|
@ -145,8 +145,13 @@ export class NoTabsTitleControl extends TitleControl {
|
|||
this.redraw();
|
||||
}
|
||||
|
||||
updateEditorLabel(editor: IEditorInput): void {
|
||||
this.ifEditorIsActive(editor, () => this.redraw());
|
||||
updateEditorLabel(editor?: IEditorInput): void {
|
||||
if (!editor) {
|
||||
editor = withNullAsUndefined(this.group.activeEditor);
|
||||
}
|
||||
if (editor) {
|
||||
this.ifEditorIsActive(editor, () => this.redraw());
|
||||
}
|
||||
}
|
||||
|
||||
updateEditorDirty(editor: IEditorInput): void {
|
||||
|
|
|
@ -41,6 +41,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
|||
import { BreadcrumbsControl } from 'vs/workbench/browser/parts/editor/breadcrumbsControl';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
|
||||
interface IEditorInputLabel {
|
||||
name: string;
|
||||
|
@ -83,8 +84,9 @@ export class TabsTitleControl extends TitleControl {
|
|||
@IExtensionService extensionService: IExtensionService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IFileService fileService: IFileService,
|
||||
@ILabelService labelService: ILabelService
|
||||
) {
|
||||
super(parent, accessor, group, contextMenuService, instantiationService, contextKeyService, keybindingService, telemetryService, notificationService, menuService, quickOpenService, themeService, extensionService, configurationService, fileService);
|
||||
super(parent, accessor, group, contextMenuService, instantiationService, contextKeyService, keybindingService, telemetryService, notificationService, menuService, quickOpenService, themeService, extensionService, configurationService, fileService, labelService);
|
||||
}
|
||||
|
||||
protected create(parent: HTMLElement): void {
|
||||
|
|
|
@ -40,6 +40,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
|
|||
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
|
||||
export interface IToolbarActions {
|
||||
primary: IAction[];
|
||||
|
@ -78,6 +79,7 @@ export abstract class TitleControl extends Themable {
|
|||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IConfigurationService protected configurationService: IConfigurationService,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@ILabelService private readonly labelService: ILabelService
|
||||
) {
|
||||
super(themeService);
|
||||
|
||||
|
@ -90,6 +92,7 @@ export abstract class TitleControl extends Themable {
|
|||
|
||||
private registerListeners(): void {
|
||||
this._register(this.extensionService.onDidRegisterExtensions(() => this.updateEditorActionsToolbar()));
|
||||
this._register(this.labelService.onDidChangeFormatters(() => this.updateEditorLabel()));
|
||||
}
|
||||
|
||||
protected abstract create(parent: HTMLElement): void;
|
||||
|
@ -339,7 +342,7 @@ export abstract class TitleControl extends Themable {
|
|||
|
||||
abstract setActive(isActive: boolean): void;
|
||||
|
||||
abstract updateEditorLabel(editor: IEditorInput): void;
|
||||
abstract updateEditorLabel(editor?: IEditorInput): void;
|
||||
|
||||
abstract updateEditorDirty(editor: IEditorInput): void;
|
||||
|
||||
|
|
Loading…
Reference in a new issue