提交 1b16063c 编写于 作者: B Benjamin Pasero

fix #76573

上级 3e25e268
......@@ -317,40 +317,31 @@ class ResourceLabelWidget extends IconLabel {
}
notifyFormattersChange(): void {
if (this.label && this.label.resource) {
this.setFile(this.label.resource, this.options);
}
this.render(false);
}
setResource(label: IResourceLabelProps, options?: IResourceLabelOptions): void {
const hasResourceChanged = this.hasResourceChanged(label, options);
this.label = label;
this.options = options;
if (hasResourceChanged) {
if (this.hasPathLabelChanged(label, options)) {
this.computedPathLabel = undefined; // reset path label due to resource change
}
this.render(hasResourceChanged);
this.render(this.clearIconCache(label, options));
}
private hasResourceChanged(label: IResourceLabelProps, options?: IResourceLabelOptions): boolean {
const newResource = label ? label.resource : undefined;
private clearIconCache(newLabel: IResourceLabelProps, newOptions?: IResourceLabelOptions): boolean {
const newResource = newLabel ? newLabel.resource : undefined;
const oldResource = this.label ? this.label.resource : undefined;
const newFileKind = options ? options.fileKind : undefined;
const newFileKind = newOptions ? newOptions.fileKind : undefined;
const oldFileKind = this.options ? this.options.fileKind : undefined;
if (newFileKind !== oldFileKind) {
return true; // same resource but different kind (file, folder)
}
if (newResource && this.computedPathLabel !== this.labelService.getUriLabel(newResource)) {
return true;
}
if (newResource && oldResource) {
return newResource.toString() !== oldResource.toString();
}
......@@ -362,6 +353,12 @@ class ResourceLabelWidget extends IconLabel {
return true;
}
private hasPathLabelChanged(newLabel: IResourceLabelProps, newOptions?: IResourceLabelOptions): boolean {
const newResource = newLabel ? newLabel.resource : undefined;
return !!newResource && this.computedPathLabel !== this.labelService.getUriLabel(newResource);
}
setEditor(editor: IEditorInput, options?: IResourceLabelOptions): void {
this.setResource({
resource: toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册