提交 01a3f15a 编写于 作者: I isidor

explorer: when can not resolve root create a dummy error placeholder

上级 dd35bbd8
......@@ -67,7 +67,8 @@ export class ExplorerDataSource implements IAsyncDataSource<ExplorerItem | Explo
@INotificationService private readonly notificationService: INotificationService,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
@IFileService private readonly fileService: IFileService,
@IExplorerService private readonly explorerService: IExplorerService
@IExplorerService private readonly explorerService: IExplorerService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService
) { }
hasChildren(element: ExplorerItem | ExplorerItem[]): boolean {
......@@ -80,8 +81,17 @@ export class ExplorerDataSource implements IAsyncDataSource<ExplorerItem | Explo
}
const promise = element.fetchChildren(this.fileService, this.explorerService).then(undefined, e => {
// Do not show error for roots since we already use an explorer decoration to notify user
if (!(element instanceof ExplorerItem && element.isRoot)) {
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, undefined, false);
placeholder.isError = true;
return [placeholder];
}
} else {
// Do not show error for roots since we already use an explorer decoration to notify user
this.notificationService.error(e);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册