Skip to content

Commit ff6ef95

Browse files
committed
titleControl: update labels once new formater gets registered
1 parent b2e7941 commit ff6ef95

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,13 @@ export class NoTabsTitleControl extends TitleControl {
145145
this.redraw();
146146
}
147147

148-
updateEditorLabel(editor: IEditorInput): void {
149-
this.ifEditorIsActive(editor, () => this.redraw());
148+
updateEditorLabel(editor?: IEditorInput): void {
149+
if (!editor) {
150+
editor = withNullAsUndefined(this.group.activeEditor);
151+
}
152+
if (editor) {
153+
this.ifEditorIsActive(editor, () => this.redraw());
154+
}
150155
}
151156

152157
updateEditorDirty(editor: IEditorInput): void {

src/vs/workbench/browser/parts/editor/tabsTitleControl.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
4141
import { BreadcrumbsControl } from 'vs/workbench/browser/parts/editor/breadcrumbsControl';
4242
import { IFileService } from 'vs/platform/files/common/files';
4343
import { withNullAsUndefined } from 'vs/base/common/types';
44+
import { ILabelService } from 'vs/platform/label/common/label';
4445

4546
interface IEditorInputLabel {
4647
name: string;
@@ -83,8 +84,9 @@ export class TabsTitleControl extends TitleControl {
8384
@IExtensionService extensionService: IExtensionService,
8485
@IConfigurationService configurationService: IConfigurationService,
8586
@IFileService fileService: IFileService,
87+
@ILabelService labelService: ILabelService
8688
) {
87-
super(parent, accessor, group, contextMenuService, instantiationService, contextKeyService, keybindingService, telemetryService, notificationService, menuService, quickOpenService, themeService, extensionService, configurationService, fileService);
89+
super(parent, accessor, group, contextMenuService, instantiationService, contextKeyService, keybindingService, telemetryService, notificationService, menuService, quickOpenService, themeService, extensionService, configurationService, fileService, labelService);
8890
}
8991

9092
protected create(parent: HTMLElement): void {

src/vs/workbench/browser/parts/editor/titleControl.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
4040
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
4141
import { IFileService } from 'vs/platform/files/common/files';
4242
import { withNullAsUndefined } from 'vs/base/common/types';
43+
import { ILabelService } from 'vs/platform/label/common/label';
4344

4445
export interface IToolbarActions {
4546
primary: IAction[];
@@ -78,6 +79,7 @@ export abstract class TitleControl extends Themable {
7879
@IExtensionService private readonly extensionService: IExtensionService,
7980
@IConfigurationService protected configurationService: IConfigurationService,
8081
@IFileService private readonly fileService: IFileService,
82+
@ILabelService private readonly labelService: ILabelService
8183
) {
8284
super(themeService);
8385

@@ -90,6 +92,7 @@ export abstract class TitleControl extends Themable {
9092

9193
private registerListeners(): void {
9294
this._register(this.extensionService.onDidRegisterExtensions(() => this.updateEditorActionsToolbar()));
95+
this._register(this.labelService.onDidChangeFormatters(() => this.updateEditorLabel()));
9396
}
9497

9598
protected abstract create(parent: HTMLElement): void;
@@ -339,7 +342,7 @@ export abstract class TitleControl extends Themable {
339342

340343
abstract setActive(isActive: boolean): void;
341344

342-
abstract updateEditorLabel(editor: IEditorInput): void;
345+
abstract updateEditorLabel(editor?: IEditorInput): void;
343346

344347
abstract updateEditorDirty(editor: IEditorInput): void;
345348

0 commit comments

Comments
 (0)