mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 11:08:31 -05:00
Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)
* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 * disable strict null check
This commit is contained in:
@@ -6,21 +6,20 @@
|
||||
import 'vs/workbench/browser/style';
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { setFileNameComparer } from 'vs/base/common/comparers';
|
||||
import { Event, Emitter, setGlobalLeakWarningThreshold } from 'vs/base/common/event';
|
||||
import { addClasses, addClass, removeClasses } from 'vs/base/browser/dom';
|
||||
import { runWhenIdle, IdleValue } from 'vs/base/common/async';
|
||||
import { runWhenIdle } from 'vs/base/common/async';
|
||||
import { getZoomLevel } from 'vs/base/browser/browser';
|
||||
import { mark } from 'vs/base/common/performance';
|
||||
import { onUnexpectedError, setUnexpectedErrorHandler } from 'vs/base/common/errors';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { isWindows, isLinux, isWeb } from 'vs/base/common/platform';
|
||||
import { isWindows, isLinux, isWeb, isNative } from 'vs/base/common/platform';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { IEditorInputFactoryRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs/workbench/browser/actions';
|
||||
import { getServices } from 'vs/platform/instantiation/common/extensions';
|
||||
import { getSingletonServiceDescriptors } from 'vs/platform/instantiation/common/extensions';
|
||||
import { Position, Parts, IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IStorageService, WillSaveStateReason, StorageScope, IWillSaveStateEvent } 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';
|
||||
@@ -37,7 +36,7 @@ import { NotificationsToasts } from 'vs/workbench/browser/parts/notifications/no
|
||||
import { IEditorService, IResourceEditor } 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 { restoreFontInfo, readFontInfo, saveFontInfo } from 'vs/editor/browser/config/configuration';
|
||||
import { readFontInfo, restoreFontInfo, serializeFontInfo } from 'vs/editor/browser/config/configuration';
|
||||
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
@@ -53,10 +52,10 @@ import { AdsTelemetryService } from 'sql/platform/telemetry/adsTelemetryService'
|
||||
export class Workbench extends Layout {
|
||||
|
||||
private readonly _onShutdown = this._register(new Emitter<void>());
|
||||
get onShutdown(): Event<void> { return this._onShutdown.event; }
|
||||
readonly onShutdown: Event<void> = this._onShutdown.event;
|
||||
|
||||
private readonly _onWillShutdown = this._register(new Emitter<WillShutdownEvent>());
|
||||
get onWillShutdown(): Event<WillShutdownEvent> { return this._onWillShutdown.event; }
|
||||
readonly onWillShutdown: Event<WillShutdownEvent> = this._onWillShutdown.event;
|
||||
|
||||
constructor(
|
||||
parent: HTMLElement,
|
||||
@@ -118,15 +117,6 @@ export class Workbench extends Layout {
|
||||
// Configure emitter leak warning threshold
|
||||
setGlobalLeakWarningThreshold(175);
|
||||
|
||||
// Setup Intl for comparers
|
||||
setFileNameComparer(new IdleValue(() => {
|
||||
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });
|
||||
return {
|
||||
collator: collator,
|
||||
collatorIsNumeric: collator.resolvedOptions().numeric
|
||||
};
|
||||
}));
|
||||
|
||||
// ARIA
|
||||
setARIAContainer(document.body);
|
||||
|
||||
@@ -186,9 +176,9 @@ export class Workbench extends Layout {
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
// All Contributed Services
|
||||
const contributedServices = getServices();
|
||||
for (let contributedService of contributedServices) {
|
||||
serviceCollection.set(contributedService.id, contributedService.descriptor);
|
||||
const contributedServices = getSingletonServiceDescriptors();
|
||||
for (let [id, descriptor] of contributedServices) {
|
||||
serviceCollection.set(id, descriptor);
|
||||
}
|
||||
|
||||
const instantiationService = new InstantiationService(serviceCollection, true);
|
||||
@@ -236,11 +226,11 @@ export class Workbench extends Layout {
|
||||
this.dispose();
|
||||
}));
|
||||
|
||||
// Storage
|
||||
this._register(storageService.onWillSaveState(() => saveFontInfo(storageService)));
|
||||
|
||||
// Configuration changes
|
||||
this._register(configurationService.onDidChangeConfiguration(() => this.setFontAliasing(configurationService)));
|
||||
|
||||
// Storage
|
||||
this._register(storageService.onWillSaveState(e => this.storeFontInfo(e, storageService)));
|
||||
}
|
||||
|
||||
private fontAliasing: 'default' | 'antialiased' | 'none' | 'auto';
|
||||
@@ -262,6 +252,35 @@ export class Workbench extends Layout {
|
||||
}
|
||||
}
|
||||
|
||||
private restoreFontInfo(storageService: IStorageService, configurationService: IConfigurationService): void {
|
||||
|
||||
// Restore (native: use storage service, web: use browser specific local storage)
|
||||
const storedFontInfoRaw = isNative ? storageService.get('editorFontInfo', StorageScope.GLOBAL) : window.localStorage.getItem('editorFontInfo');
|
||||
if (storedFontInfoRaw) {
|
||||
try {
|
||||
const storedFontInfo = JSON.parse(storedFontInfoRaw);
|
||||
if (Array.isArray(storedFontInfo)) {
|
||||
restoreFontInfo(storedFontInfo);
|
||||
}
|
||||
} catch (err) {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
readFontInfo(BareFontInfo.createFromRawSettings(configurationService.getValue('editor'), getZoomLevel()));
|
||||
}
|
||||
|
||||
private storeFontInfo(e: IWillSaveStateEvent, storageService: IStorageService): void {
|
||||
if (e.reason === WillSaveStateReason.SHUTDOWN) {
|
||||
const serializedFontInfo = serializeFontInfo();
|
||||
if (serializedFontInfo) {
|
||||
const serializedFontInfoRaw = JSON.stringify(serializedFontInfo);
|
||||
|
||||
isNative ? storageService.store('editorFontInfo', serializedFontInfoRaw, StorageScope.GLOBAL) : window.localStorage.setItem('editorFontInfo', serializedFontInfoRaw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private renderWorkbench(instantiationService: IInstantiationService, notificationService: NotificationService, storageService: IStorageService, configurationService: IConfigurationService): void {
|
||||
|
||||
// State specific classes
|
||||
@@ -269,6 +288,7 @@ export class Workbench extends Layout {
|
||||
const workbenchClasses = coalesce([
|
||||
'monaco-workbench',
|
||||
platformClass,
|
||||
isWeb ? 'web' : undefined,
|
||||
this.state.sideBar.hidden ? 'nosidebar' : undefined,
|
||||
this.state.panel.hidden ? 'nopanel' : undefined,
|
||||
this.state.statusBar.hidden ? 'nostatusbar' : undefined,
|
||||
@@ -286,8 +306,7 @@ export class Workbench extends Layout {
|
||||
this.setFontAliasing(configurationService);
|
||||
|
||||
// Warm up font cache information before building up too many dom elements
|
||||
restoreFontInfo(storageService);
|
||||
readFontInfo(BareFontInfo.createFromRawSettings(configurationService.getValue('editor'), getZoomLevel()));
|
||||
this.restoreFontInfo(storageService, configurationService);
|
||||
|
||||
// Create Parts
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user