mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-22 04:40:30 -04:00
Merge from vscode 6e530127a1bb8ffbd1bfb77dc680c321dc0d71f5 (#6844)
This commit is contained in:
@@ -317,40 +317,34 @@ 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);
|
||||
const hasPathLabelChanged = this.hasPathLabelChanged(label, options);
|
||||
const clearIconCache = this.clearIconCache(label, options);
|
||||
|
||||
this.label = label;
|
||||
this.options = options;
|
||||
|
||||
if (hasResourceChanged) {
|
||||
if (hasPathLabelChanged) {
|
||||
this.computedPathLabel = undefined; // reset path label due to resource change
|
||||
}
|
||||
|
||||
this.render(hasResourceChanged);
|
||||
this.render(clearIconCache);
|
||||
}
|
||||
|
||||
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 +356,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 }),
|
||||
@@ -460,6 +460,7 @@ class ResourceLabelWidget extends IconLabel {
|
||||
}
|
||||
iconLabelOptions.extraClasses = this.computedIconClasses.slice(0);
|
||||
}
|
||||
|
||||
if (this.options && this.options.extraClasses) {
|
||||
iconLabelOptions.extraClasses!.push(...this.options.extraClasses);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user