mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae
This commit is contained in:
committed by
AzureDataStudio
parent
a971aee5bd
commit
5e7071e466
@@ -20,9 +20,7 @@ import { getSingletonServiceDescriptors } from 'vs/platform/instantiation/common
|
||||
import { Position, Parts, IWorkbenchLayoutService, positionToString } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { IStorageService, WillSaveStateReason, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { LifecyclePhase, ILifecycleService, WillShutdownEvent, BeforeShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
@@ -32,8 +30,6 @@ import { NotificationsAlerts } from 'vs/workbench/browser/parts/notifications/no
|
||||
import { NotificationsStatus } from 'vs/workbench/browser/parts/notifications/notificationsStatus';
|
||||
import { registerNotificationCommands } from 'vs/workbench/browser/parts/notifications/notificationsCommands';
|
||||
import { NotificationsToasts } from 'vs/workbench/browser/parts/notifications/notificationsToasts';
|
||||
import { IEditorService, IResourceEditorInputType } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { setARIAContainer } from 'vs/base/browser/ui/aria/aria';
|
||||
import { readFontInfo, restoreFontInfo, serializeFontInfo } from 'vs/editor/browser/config/configuration';
|
||||
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
|
||||
@@ -44,9 +40,6 @@ import { coalesce } from 'vs/base/common/arrays';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { Layout } from 'vs/workbench/browser/layout';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { ILanguageAssociationRegistry, Extensions as LanguageExtensions } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { Extensions as PanelExtensions, PanelRegistry } from 'vs/workbench/browser/panel';
|
||||
import { IViewDescriptorService, ViewContainerLocation } from 'vs/workbench/common/views';
|
||||
|
||||
export class Workbench extends Layout {
|
||||
|
||||
@@ -146,7 +139,8 @@ export class Workbench extends Layout {
|
||||
this.initLayout(accessor);
|
||||
|
||||
// Registries
|
||||
this.startRegistries(accessor);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).start(accessor);
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories).start(accessor);
|
||||
|
||||
// Context Keys
|
||||
this._register(instantiationService.createInstance(WorkbenchContextKeysHandler));
|
||||
@@ -165,7 +159,7 @@ export class Workbench extends Layout {
|
||||
|
||||
// Restore
|
||||
try {
|
||||
await this.restoreWorkbench(accessor.get(IEditorService), accessor.get(IEditorGroupsService), accessor.get(IViewDescriptorService), accessor.get(IViewletService), accessor.get(IPanelService), accessor.get(ILogService), lifecycleService);
|
||||
await this.restoreWorkbench(accessor.get(ILogService), lifecycleService);
|
||||
} catch (error) {
|
||||
onUnexpectedError(error);
|
||||
}
|
||||
@@ -216,12 +210,6 @@ export class Workbench extends Layout {
|
||||
return instantiationService;
|
||||
}
|
||||
|
||||
private startRegistries(accessor: ServicesAccessor): void {
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).start(accessor);
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories).start(accessor);
|
||||
Registry.as<ILanguageAssociationRegistry>(LanguageExtensions.LanguageAssociations).start(accessor);
|
||||
}
|
||||
|
||||
private registerListeners(
|
||||
lifecycleService: ILifecycleService,
|
||||
storageService: IStorageService,
|
||||
@@ -367,7 +355,7 @@ export class Workbench extends Layout {
|
||||
}
|
||||
|
||||
private createPart(id: string, role: string, classes: string[]): HTMLElement {
|
||||
const part = document.createElement('div');
|
||||
const part = document.createElement(role === 'status' ? 'footer' : 'div'); // Use footer element for status bar #98376
|
||||
addClasses(part, 'part', ...classes);
|
||||
part.id = id;
|
||||
part.setAttribute('role', role);
|
||||
@@ -401,81 +389,15 @@ export class Workbench extends Layout {
|
||||
}
|
||||
|
||||
private async restoreWorkbench(
|
||||
editorService: IEditorService,
|
||||
editorGroupService: IEditorGroupsService,
|
||||
viewDescriptorService: IViewDescriptorService,
|
||||
viewletService: IViewletService,
|
||||
panelService: IPanelService,
|
||||
logService: ILogService,
|
||||
lifecycleService: ILifecycleService
|
||||
): Promise<void> {
|
||||
const restorePromises: Promise<void>[] = [];
|
||||
|
||||
// Restore editors
|
||||
restorePromises.push((async () => {
|
||||
mark('willRestoreEditors');
|
||||
|
||||
// first ensure the editor part is restored
|
||||
await editorGroupService.whenRestored;
|
||||
|
||||
// then see for editors to open as instructed
|
||||
let editors: IResourceEditorInputType[];
|
||||
if (Array.isArray(this.state.editor.editorsToOpen)) {
|
||||
editors = this.state.editor.editorsToOpen;
|
||||
} else {
|
||||
editors = await this.state.editor.editorsToOpen;
|
||||
}
|
||||
|
||||
if (editors.length) {
|
||||
await editorService.openEditors(editors);
|
||||
}
|
||||
|
||||
mark('didRestoreEditors');
|
||||
})());
|
||||
|
||||
// Restore Sidebar
|
||||
if (this.state.sideBar.viewletToRestore) {
|
||||
restorePromises.push((async () => {
|
||||
mark('willRestoreViewlet');
|
||||
|
||||
const viewlet = await viewletService.openViewlet(this.state.sideBar.viewletToRestore);
|
||||
if (!viewlet) {
|
||||
await viewletService.openViewlet(viewDescriptorService.getDefaultViewContainer(ViewContainerLocation.Sidebar)?.id); // fallback to default viewlet as needed
|
||||
}
|
||||
|
||||
mark('didRestoreViewlet');
|
||||
})());
|
||||
}
|
||||
|
||||
// Restore Panel
|
||||
if (this.state.panel.panelToRestore) {
|
||||
restorePromises.push((async () => {
|
||||
mark('willRestorePanel');
|
||||
|
||||
const panel = await panelService.openPanel(this.state.panel.panelToRestore!);
|
||||
if (!panel) {
|
||||
await panelService.openPanel(Registry.as<PanelRegistry>(PanelExtensions.Panels).getDefaultPanelId()); // fallback to default panel as needed
|
||||
}
|
||||
|
||||
mark('didRestorePanel');
|
||||
})());
|
||||
}
|
||||
|
||||
// Restore Zen Mode
|
||||
if (this.state.zenMode.restore) {
|
||||
this.toggleZenMode(false, true);
|
||||
}
|
||||
|
||||
// Restore Editor Center Mode
|
||||
if (this.state.editor.restoreCentered) {
|
||||
this.centerEditorLayout(true, true);
|
||||
}
|
||||
|
||||
// Emit a warning after 10s if restore does not complete
|
||||
const restoreTimeoutHandle = setTimeout(() => logService.warn('Workbench did not finish loading in 10 seconds, that might be a problem that should be reported.'), 10000);
|
||||
|
||||
try {
|
||||
await Promise.all(restorePromises);
|
||||
await super.restoreWorkbenchLayout();
|
||||
|
||||
clearTimeout(restoreTimeoutHandle);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user