Merge from vscode 5b9869eb02fa4c96205a74d05cad9164dfd06d60 (#5607)

This commit is contained in:
Anthony Dresser
2019-05-24 12:20:30 -07:00
committed by GitHub
parent 361ada4963
commit bcc449b524
126 changed files with 3096 additions and 2255 deletions

View File

@@ -618,21 +618,19 @@ export class ViewsService extends Disposable implements IViewsService {
return viewDescriptorCollectionItem ? viewDescriptorCollectionItem.viewDescriptorCollection : null;
}
openView(id: string, focus: boolean): Promise<IView | null> {
async openView(id: string, focus: boolean): Promise<IView | null> {
const viewContainer = Registry.as<IViewsRegistry>(ViewExtensions.ViewsRegistry).getViewContainer(id);
if (viewContainer) {
const viewletDescriptor = this.viewletService.getViewlet(viewContainer.id);
if (viewletDescriptor) {
return this.viewletService.openViewlet(viewletDescriptor.id, focus)
.then((viewlet: IViewsViewlet) => {
if (viewlet && viewlet.openView) {
return viewlet.openView(id, focus);
}
return null;
});
const viewlet = await this.viewletService.openViewlet(viewletDescriptor.id, focus) as IViewsViewlet | null;
if (viewlet && viewlet.openView) {
return viewlet.openView(id, focus);
}
}
}
return Promise.resolve(null);
return null;
}
private onDidRegisterViewContainer(viewContainer: ViewContainer): void {
@@ -669,7 +667,7 @@ export class ViewsService extends Disposable implements IViewsService {
};
const when = ContextKeyExpr.has(`${viewDescriptor.id}.active`);
disposables.push(CommandsRegistry.registerCommand(command.id, () => this.openView(viewDescriptor.id, true).then(() => null)));
disposables.push(CommandsRegistry.registerCommand(command.id, () => this.openView(viewDescriptor.id, true)));
disposables.push(MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command,