Merge pull request #126843 from gjsjohnmurray/fix-126842
fix #126842 clear Explorer root folder error indicator when refresh succeeds
This commit is contained in:
commit
97faef955a
|
@ -91,25 +91,34 @@ export class ExplorerDataSource implements IAsyncDataSource<ExplorerItem | Explo
|
|||
return Promise.resolve(element);
|
||||
}
|
||||
|
||||
const wasError = element.isError;
|
||||
const sortOrder = this.explorerService.sortOrderConfiguration.sortOrder;
|
||||
const promise = element.fetchChildren(sortOrder).then(undefined, e => {
|
||||
|
||||
if (element instanceof ExplorerItem && element.isRoot) {
|
||||
if (this.contextService.getWorkbenchState() === WorkbenchState.FOLDER) {
|
||||
// Single folder create a dummy explorer item to show error
|
||||
const placeholder = new ExplorerItem(element.resource, this.fileService, undefined, false);
|
||||
placeholder.isError = true;
|
||||
return [placeholder];
|
||||
} else {
|
||||
const promise = element.fetchChildren(sortOrder).then(
|
||||
children => {
|
||||
// Clear previous error decoration on root folder
|
||||
if (element instanceof ExplorerItem && element.isRoot && !element.isError && wasError && this.contextService.getWorkbenchState() !== WorkbenchState.FOLDER) {
|
||||
explorerRootErrorEmitter.fire(element.resource);
|
||||
}
|
||||
} else {
|
||||
// Do not show error for roots since we already use an explorer decoration to notify user
|
||||
this.notificationService.error(e);
|
||||
return children;
|
||||
}
|
||||
, e => {
|
||||
|
||||
return []; // we could not resolve any children because of an error
|
||||
});
|
||||
if (element instanceof ExplorerItem && element.isRoot) {
|
||||
if (this.contextService.getWorkbenchState() === WorkbenchState.FOLDER) {
|
||||
// Single folder create a dummy explorer item to show error
|
||||
const placeholder = new ExplorerItem(element.resource, this.fileService, undefined, false);
|
||||
placeholder.isError = true;
|
||||
return [placeholder];
|
||||
} else {
|
||||
explorerRootErrorEmitter.fire(element.resource);
|
||||
}
|
||||
} else {
|
||||
// Do not show error for roots since we already use an explorer decoration to notify user
|
||||
this.notificationService.error(e);
|
||||
}
|
||||
|
||||
return []; // we could not resolve any children because of an error
|
||||
});
|
||||
|
||||
this.progressService.withProgress({
|
||||
location: ProgressLocation.Explorer,
|
||||
|
|
|
@ -286,6 +286,7 @@ export class ExplorerItem {
|
|||
// Resolve metadata only when the mtime is needed since this can be expensive
|
||||
// Mtime is only used when the sort order is 'modified'
|
||||
const resolveMetadata = sortOrder === SortOrder.Modified;
|
||||
this.isError = false;
|
||||
try {
|
||||
const stat = await this.fileService.resolve(this.resource, { resolveSingleChildDescendants: true, resolveMetadata });
|
||||
const resolved = ExplorerItem.create(this.fileService, stat, this);
|
||||
|
|
Loading…
Reference in a new issue