mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 17:20:28 -04:00
Merge from vscode 966b87dd4013be1a9c06e2b8334522ec61905cc2 (#4696)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user