Skip to content

Commit

Permalink
resource label: redraw on formatter change
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed May 29, 2019
1 parent 4c5705f commit 4486388
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/vs/workbench/browser/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export class ResourceLabels extends Disposable {
@IModelService private readonly modelService: IModelService,
@IDecorationsService private readonly decorationsService: IDecorationsService,
@IThemeService private readonly themeService: IThemeService,
@IFileService private readonly fileService: IFileService
@IFileService private readonly fileService: IFileService,
@ILabelService private readonly labelService: ILabelService
) {
super();

Expand Down Expand Up @@ -145,6 +146,10 @@ export class ResourceLabels extends Disposable {
this._widgets.forEach(widget => widget.notifyFileAssociationsChange());
}
}));

this._register(this.labelService.onDidChangeFormatters(() => {
this._widgets.forEach(widget => widget.notifyFormattersChange());
}));
}

get(index: number): IResourceLabel {
Expand Down Expand Up @@ -212,9 +217,10 @@ export class ResourceLabel extends ResourceLabels {
@IModelService modelService: IModelService,
@IDecorationsService decorationsService: IDecorationsService,
@IThemeService themeService: IThemeService,
@IFileService fileService: IFileService
@IFileService fileService: IFileService,
@ILabelService labelService: ILabelService
) {
super(DEFAULT_LABELS_CONTAINER, instantiationService, extensionService, configurationService, modelService, decorationsService, themeService, fileService);
super(DEFAULT_LABELS_CONTAINER, instantiationService, extensionService, configurationService, modelService, decorationsService, themeService, fileService, labelService);

this._label = this._register(this.create(container, options));
}
Expand Down Expand Up @@ -309,6 +315,10 @@ class ResourceLabelWidget extends IconLabel {
this.render(true);
}

notifyFormattersChange(): void {
this.render(false);
}

setResource(label: IResourceLabelProps, options?: IResourceLabelOptions): void {
const hasResourceChanged = this.hasResourceChanged(label, options);

Expand Down

0 comments on commit 4486388

Please sign in to comment.