From 74b196495397db8896bec67972b34032ec000b00 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 31 Aug 2017 16:16:55 +0200 Subject: [PATCH] gray out nonexistent multi root folder fixes #29738 --- .../parts/files/browser/media/explorerviewlet.css | 4 ++++ .../parts/files/browser/views/explorerViewer.ts | 12 +++++++++++- src/vs/workbench/parts/files/common/explorerModel.ts | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/files/browser/media/explorerviewlet.css b/src/vs/workbench/parts/files/browser/media/explorerviewlet.css index c0718789375..b02fed754ab 100644 --- a/src/vs/workbench/parts/files/browser/media/explorerviewlet.css +++ b/src/vs/workbench/parts/files/browser/media/explorerviewlet.css @@ -142,6 +142,10 @@ padding: 0 20px 0 20px; } +.explorer-viewlet .explorer-item.nonexistent-root { + opacity: 0.5; +} + .explorer-viewlet .explorer-item .monaco-inputbox { width: 100%; line-height: normal; diff --git a/src/vs/workbench/parts/files/browser/views/explorerViewer.ts b/src/vs/workbench/parts/files/browser/views/explorerViewer.ts index ba7c3c8238b..5a15094ce05 100644 --- a/src/vs/workbench/parts/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/parts/files/browser/views/explorerViewer.ts @@ -106,7 +106,14 @@ export class FileDataSource implements IDataSource { return stat.children; }, (e: any) => { - this.messageService.show(Severity.Error, e); + stat.exists = false; + stat.hasChildren = false; + if (!stat.isRoot) { + this.messageService.show(Severity.Error, e); + } else { + // We render the roots that do not exist differently, nned to do a refresh + tree.refresh(stat, false); + } return []; // we could not resolve any children because of an error }); @@ -311,6 +318,9 @@ export class FileRenderer implements IRenderer { if (!editableData) { templateData.label.element.style.display = 'block'; const extraClasses = ['explorer-item']; + if (!stat.exists && stat.isRoot) { + extraClasses.push('nonexistent-root'); + } templateData.label.setFile(stat.resource, { hidePath: true, fileKind: stat.isRoot ? FileKind.ROOT_FOLDER : stat.isDirectory ? FileKind.FOLDER : FileKind.FILE, extraClasses }); } diff --git a/src/vs/workbench/parts/files/common/explorerModel.ts b/src/vs/workbench/parts/files/common/explorerModel.ts index c92e951555a..e3d97b1d97b 100644 --- a/src/vs/workbench/parts/files/common/explorerModel.ts +++ b/src/vs/workbench/parts/files/common/explorerModel.ts @@ -71,6 +71,7 @@ export class FileStat implements IFileStat { public children: FileStat[]; public parent: FileStat; + public exists: boolean; public isDirectoryResolved: boolean; constructor(resource: URI, public root: FileStat, isDirectory?: boolean, hasChildren?: boolean, name: string = paths.basename(resource.fsPath), mtime?: number, etag?: string) { @@ -90,6 +91,7 @@ export class FileStat implements IFileStat { } this.isDirectoryResolved = false; + this.exists = true; } public getId(): string { -- GitLab