Merge from vscode 966b87dd4013be1a9c06e2b8334522ec61905cc2 (#4696)

This commit is contained in:
Anthony Dresser
2019-03-26 11:43:38 -07:00
committed by GitHub
parent b1393ae615
commit 0d8ef9583b
268 changed files with 5947 additions and 3422 deletions

View File

@@ -285,16 +285,15 @@ export class ExplorerView extends ViewletPanel {
accessibilityProvider: new ExplorerAccessibilityProvider(),
ariaLabel: nls.localize('treeAriaLabel', "Files Explorer"),
identityProvider: {
getId: stat => (<ExplorerItem>stat).resource
getId: (stat: ExplorerItem) => stat.resource
},
keyboardNavigationLabelProvider: {
getKeyboardNavigationLabel: stat => {
const item = <ExplorerItem>stat;
if (this.explorerService.isEditable(item)) {
getKeyboardNavigationLabel: (stat: ExplorerItem) => {
if (this.explorerService.isEditable(stat)) {
return undefined;
}
return item.name;
return stat.name;
}
},
multipleSelectionSupport: true,

View File

@@ -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);
}