提交 16477bd3 编写于 作者: B Benjamin Pasero

Fix resource lookup in labels (#94715)

上级 723504a7
...@@ -289,11 +289,12 @@ class ResourceLabelWidget extends IconLabel { ...@@ -289,11 +289,12 @@ class ResourceLabelWidget extends IconLabel {
} }
private handleModelEvent(model: ITextModel): void { private handleModelEvent(model: ITextModel): void {
if (!this.label || !this.label.resource) { const resource = toResource(this.label);
return; // only update if label exists if (!resource) {
return; // only update if resource exists
} }
if (model.uri.toString() === this.label.resource.toString()) { if (model.uri.toString() === resource.toString()) {
if (this.lastKnownDetectedModeId !== model.getModeId()) { if (this.lastKnownDetectedModeId !== model.getModeId()) {
this.render(true); // update if the language id of the model has changed from our last known state this.render(true); // update if the language id of the model has changed from our last known state
} }
...@@ -417,8 +418,8 @@ class ResourceLabelWidget extends IconLabel { ...@@ -417,8 +418,8 @@ class ResourceLabelWidget extends IconLabel {
} }
private clearIconCache(newLabel: IResourceLabelProps, newOptions?: IResourceLabelOptions): boolean { private clearIconCache(newLabel: IResourceLabelProps, newOptions?: IResourceLabelOptions): boolean {
const newResource = newLabel ? newLabel.resource : undefined; const newResource = toResource(newLabel);
const oldResource = this.label ? this.label.resource : undefined; const oldResource = toResource(this.label);
const newFileKind = newOptions ? newOptions.fileKind : undefined; const newFileKind = newOptions ? newOptions.fileKind : undefined;
const oldFileKind = this.options ? this.options.fileKind : undefined; const oldFileKind = this.options ? this.options.fileKind : undefined;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册