mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Open Editors icon sometimes doesn't update when language is changed (fix #147733)
This commit is contained in:
parent
4875bf81b7
commit
e43b54417f
|
@ -272,14 +272,15 @@ class ResourceLabelWidget extends IconLabel {
|
|||
private readonly _onDidRender = this._register(new Emitter<void>());
|
||||
readonly onDidRender = this._onDidRender.event;
|
||||
|
||||
private label?: IResourceLabelProps;
|
||||
private label: IResourceLabelProps | undefined = undefined;
|
||||
private decoration = this._register(new MutableDisposable<IDecoration>());
|
||||
private options?: IResourceLabelOptions;
|
||||
private computedIconClasses?: string[];
|
||||
private lastKnownDetectedLanguageId?: string;
|
||||
private computedPathLabel?: string;
|
||||
private options: IResourceLabelOptions | undefined = undefined;
|
||||
|
||||
private needsRedraw?: Redraw;
|
||||
private computedIconClasses: string[] | undefined = undefined;
|
||||
private computedLanguageId: string | undefined = undefined;
|
||||
private computedPathLabel: string | undefined = undefined;
|
||||
|
||||
private needsRedraw: Redraw | undefined = undefined;
|
||||
private isHidden: boolean = false;
|
||||
|
||||
constructor(
|
||||
|
@ -325,8 +326,8 @@ class ResourceLabelWidget extends IconLabel {
|
|||
}
|
||||
|
||||
if (isEqual(model.uri, resource)) {
|
||||
if (this.lastKnownDetectedLanguageId !== model.getLanguageId()) {
|
||||
this.lastKnownDetectedLanguageId = model.getLanguageId();
|
||||
if (this.computedLanguageId !== model.getLanguageId()) {
|
||||
this.computedLanguageId = model.getLanguageId();
|
||||
this.render({ updateIcon: true, updateDecoration: false }); // update if the language id of the model has changed from our last known state
|
||||
}
|
||||
}
|
||||
|
@ -444,8 +445,12 @@ class ResourceLabelWidget extends IconLabel {
|
|||
this.label = label;
|
||||
this.options = options;
|
||||
|
||||
if (hasResourceChanged) {
|
||||
this.computedLanguageId = undefined; // reset computed language since resource changed
|
||||
}
|
||||
|
||||
if (hasPathLabelChanged) {
|
||||
this.computedPathLabel = undefined; // reset path label due to resource change
|
||||
this.computedPathLabel = undefined; // reset path label due to resource/path-label change
|
||||
}
|
||||
|
||||
this.render({
|
||||
|
@ -485,7 +490,7 @@ class ResourceLabelWidget extends IconLabel {
|
|||
clear(): void {
|
||||
this.label = undefined;
|
||||
this.options = undefined;
|
||||
this.lastKnownDetectedLanguageId = undefined;
|
||||
this.computedLanguageId = undefined;
|
||||
this.computedIconClasses = undefined;
|
||||
this.computedPathLabel = undefined;
|
||||
|
||||
|
@ -594,7 +599,7 @@ class ResourceLabelWidget extends IconLabel {
|
|||
|
||||
this.label = undefined;
|
||||
this.options = undefined;
|
||||
this.lastKnownDetectedLanguageId = undefined;
|
||||
this.computedLanguageId = undefined;
|
||||
this.computedIconClasses = undefined;
|
||||
this.computedPathLabel = undefined;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue