From 8fe778bd57b44cee9976ac905ba91c4b151e25da Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 14 Nov 2017 07:38:57 +0100 Subject: [PATCH] adopt lifecycle phases for workbench contributions (fixes #38080) --- .../electron-browser/extensionHost.contribution.ts | 5 ++--- src/vs/workbench/common/contributions.ts | 2 +- .../parts/backup/common/backup.contribution.ts | 9 +++------ .../debug/electron-browser/debug.contribution.ts | 9 +++++---- .../electron-browser/extensions.contribution.ts | 7 ++++--- .../parts/files/browser/files.contribution.ts | 13 ++++--------- .../parts/markers/browser/markersFileDecorations.ts | 3 ++- .../electron-browser/performance.contribution.ts | 7 ++----- .../preferences/browser/preferences.contribution.ts | 3 ++- .../electron-browser/relauncher.contribution.ts | 3 ++- .../parts/scm/electron-browser/scm.contribution.ts | 7 ++++--- .../parts/search/browser/replaceContributions.ts | 3 ++- .../languageSurveys.contribution.ts | 3 ++- .../surveys/electron-browser/nps.contribution.ts | 3 ++- .../tasks/electron-browser/task.contribution.ts | 2 -- .../unsupportedWorkspaceSettings.contribution.ts | 4 ++-- .../update/electron-browser/update.contribution.ts | 5 +++-- .../parts/watermark/electron-browser/watermark.ts | 12 +++++------- .../electron-browser/gettingStarted.contribution.ts | 3 ++- .../electron-browser/welcomePage.contribution.ts | 3 ++- .../welcome/page/electron-browser/welcomePage.ts | 7 ++----- .../electron-browser/walkThrough.contribution.ts | 5 +++-- 22 files changed, 56 insertions(+), 62 deletions(-) diff --git a/src/vs/workbench/api/electron-browser/extensionHost.contribution.ts b/src/vs/workbench/api/electron-browser/extensionHost.contribution.ts index 6fff94f17b5..4cfcdb73ee0 100644 --- a/src/vs/workbench/api/electron-browser/extensionHost.contribution.ts +++ b/src/vs/workbench/api/electron-browser/extensionHost.contribution.ts @@ -8,6 +8,7 @@ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { Registry } from 'vs/platform/registry/common/platform'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; // --- other interested parties import { JSONValidationExtensionPoint } from 'vs/platform/jsonschemas/common/jsonValidationExtensionPoint'; @@ -64,6 +65,4 @@ export class ExtensionPoints implements IWorkbenchContribution { } } -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution( - ExtensionPoints -); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ExtensionPoints, LifecyclePhase.Starting); diff --git a/src/vs/workbench/common/contributions.ts b/src/vs/workbench/common/contributions.ts index e826e157282..a9b752f982c 100644 --- a/src/vs/workbench/common/contributions.ts +++ b/src/vs/workbench/common/contributions.ts @@ -35,7 +35,7 @@ export interface IWorkbenchContributionsRegistry { * * @param phase the lifecycle phase when to instantiate the contribution. */ - registerWorkbenchContribution(contribution: IWorkbenchContributionSignature, phase?: LifecyclePhase): void; + registerWorkbenchContribution(contribution: IWorkbenchContributionSignature, phase: LifecyclePhase): void; /** * Starts the registry by providing the required services. diff --git a/src/vs/workbench/parts/backup/common/backup.contribution.ts b/src/vs/workbench/parts/backup/common/backup.contribution.ts index cd58285fff0..09050b6e5d7 100644 --- a/src/vs/workbench/parts/backup/common/backup.contribution.ts +++ b/src/vs/workbench/parts/backup/common/backup.contribution.ts @@ -9,13 +9,10 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { BackupModelTracker } from 'vs/workbench/parts/backup/common/backupModelTracker'; import { BackupRestorer } from 'vs/workbench/parts/backup/common/backupRestorer'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; // Register Backup Model Tracker -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution( - BackupModelTracker -); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(BackupModelTracker, LifecyclePhase.Starting); // Register Backup Restorer -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution( - BackupRestorer -); \ No newline at end of file +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(BackupRestorer, LifecyclePhase.Starting); \ No newline at end of file diff --git a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts index 5bc4348995b..2203a758fa5 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts @@ -46,6 +46,7 @@ import { DebugViewlet, FocusVariablesViewAction, FocusBreakpointsViewAction, Foc import { Repl } from 'vs/workbench/parts/debug/electron-browser/repl'; import { DebugQuickOpenHandler } from 'vs/workbench/parts/debug/browser/debugQuickOpen'; import { DebugStatus } from 'vs/workbench/parts/debug/browser/debugStatus'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; class OpenDebugViewletAction extends ToggleViewletAction { public static ID = VIEWLET_ID; @@ -113,10 +114,10 @@ const registry = Registry.as(WorkbenchActionRegistryEx registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDebugPanelAction, OpenDebugPanelAction.ID, OpenDebugPanelAction.LABEL, openPanelKb), 'View: Debug Console', nls.localize('view', "View")); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDebugViewletAction, OpenDebugViewletAction.ID, OpenDebugViewletAction.LABEL, openViewletKb), 'View: Show Debug', nls.localize('view', "View")); -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugEditorModelManager); -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugActionsWidget); -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugContentProvider); -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(StatusBarColorProvider); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugEditorModelManager, LifecyclePhase.Starting); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugActionsWidget, LifecyclePhase.Starting); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugContentProvider, LifecyclePhase.Starting); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(StatusBarColorProvider, LifecyclePhase.Starting); const debugCategory = nls.localize('debugCategory', "Debug"); registry.registerWorkbenchAction(new SyncActionDescriptor( diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts b/src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts index d5a64743889..d865b71dfa6 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts @@ -39,6 +39,7 @@ import { KeymapExtensions, BetterMergeDisabled } from 'vs/workbench/parts/extens import { adoptToGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { GalleryExtensionsHandler, ExtensionsHandler } from 'vs/workbench/parts/extensions/browser/extensionsQuickOpen'; import { EditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; // Singletons registerSingleton(IExtensionGalleryService, ExtensionGalleryService); @@ -46,9 +47,9 @@ registerSingleton(IExtensionTipsService, ExtensionTipsService); registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService); const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); -workbenchRegistry.registerWorkbenchContribution(StatusUpdater); -workbenchRegistry.registerWorkbenchContribution(KeymapExtensions); -workbenchRegistry.registerWorkbenchContribution(BetterMergeDisabled); +workbenchRegistry.registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Running); +workbenchRegistry.registerWorkbenchContribution(KeymapExtensions, LifecyclePhase.Running); +workbenchRegistry.registerWorkbenchContribution(BetterMergeDisabled, LifecyclePhase.Running); Registry.as(OutputExtensions.OutputChannels) .registerChannel(ExtensionsChannelId, ExtensionsLabel); diff --git a/src/vs/workbench/parts/files/browser/files.contribution.ts b/src/vs/workbench/parts/files/browser/files.contribution.ts index d6c196e1479..f4b01bb8357 100644 --- a/src/vs/workbench/parts/files/browser/files.contribution.ts +++ b/src/vs/workbench/parts/files/browser/files.contribution.ts @@ -32,6 +32,7 @@ import { DirtyFilesTracker } from 'vs/workbench/parts/files/common/dirtyFilesTra import { ExplorerViewlet } from 'vs/workbench/parts/files/browser/explorerViewlet'; import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor'; import { DataUriEditorInput } from 'vs/workbench/common/editor/dataUriEditorInput'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; // Viewlet Action export class OpenExplorerViewletAction extends ToggleViewletAction { @@ -139,19 +140,13 @@ class FileEditorInputFactory implements IEditorInputFactory { Registry.as(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(FILE_EDITOR_INPUT_ID, FileEditorInputFactory); // Register File Editor Tracker -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution( - FileEditorTracker -); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(FileEditorTracker, LifecyclePhase.Starting); // Register Save Error Handler -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution( - SaveErrorHandler -); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(SaveErrorHandler, LifecyclePhase.Starting); // Register Dirty Files Tracker -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution( - DirtyFilesTracker -); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DirtyFilesTracker, LifecyclePhase.Starting); // Configuration const configurationRegistry = Registry.as(ConfigurationExtensions.Configuration); diff --git a/src/vs/workbench/parts/markers/browser/markersFileDecorations.ts b/src/vs/workbench/parts/markers/browser/markersFileDecorations.ts index 030a56a19be..65ee35b9c46 100644 --- a/src/vs/workbench/parts/markers/browser/markersFileDecorations.ts +++ b/src/vs/workbench/parts/markers/browser/markersFileDecorations.ts @@ -17,6 +17,7 @@ import Severity from 'vs/base/common/severity'; import { editorErrorForeground, editorWarningForeground } from 'vs/editor/common/view/editorColorRegistry'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; class MarkersDecorationsProvider implements IDecorationsProvider { @@ -95,7 +96,7 @@ class MarkersFileDecorations implements IWorkbenchContribution { } } -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(MarkersFileDecorations); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(MarkersFileDecorations, LifecyclePhase.Running); Registry.as(ConfigurationExtensions.Configuration).registerConfiguration({ 'id': 'problems', diff --git a/src/vs/workbench/parts/performance/electron-browser/performance.contribution.ts b/src/vs/workbench/parts/performance/electron-browser/performance.contribution.ts index d860eb770b9..4fe3613746f 100644 --- a/src/vs/workbench/parts/performance/electron-browser/performance.contribution.ts +++ b/src/vs/workbench/parts/performance/electron-browser/performance.contribution.ts @@ -31,10 +31,7 @@ class StartupProfiler implements IWorkbenchContribution { @IExtensionService extensionService: IExtensionService, ) { // wait for everything to be ready - TPromise.join([ - lifecycleService.when(LifecyclePhase.Running), - extensionService.onReady(), - ]).then(() => { + extensionService.onReady().then(() => { this._stopProfiling(); }); } @@ -92,4 +89,4 @@ class StartupProfiler implements IWorkbenchContribution { } const registry = Registry.as(Extensions.Workbench); -registry.registerWorkbenchContribution(StartupProfiler); +registry.registerWorkbenchContribution(StartupProfiler, LifecyclePhase.Running); diff --git a/src/vs/workbench/parts/preferences/browser/preferences.contribution.ts b/src/vs/workbench/parts/preferences/browser/preferences.contribution.ts index d24ed6250c3..29b0cd4d587 100644 --- a/src/vs/workbench/parts/preferences/browser/preferences.contribution.ts +++ b/src/vs/workbench/parts/preferences/browser/preferences.contribution.ts @@ -30,6 +30,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; registerSingleton(IPreferencesService, PreferencesService); @@ -257,7 +258,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ } }); -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(PreferencesContribution); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(PreferencesContribution, LifecyclePhase.Starting); CommandsRegistry.registerCommand(OPEN_FOLDER_SETTINGS_COMMAND, function (accessor: ServicesAccessor, args?: IWorkspaceFolder) { const preferencesService = accessor.get(IPreferencesService); diff --git a/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts b/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts index fe5c250d755..435cdebc079 100644 --- a/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts +++ b/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts @@ -19,6 +19,7 @@ import { RunOnceScheduler } from 'vs/base/common/async'; import URI from 'vs/base/common/uri'; import { isEqual } from 'vs/base/common/resources'; import { isLinux } from 'vs/base/common/platform'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; interface IConfiguration extends IWindowsConfiguration { update: { channel: string; }; @@ -161,4 +162,4 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution { } const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); -workbenchRegistry.registerWorkbenchContribution(SettingsChangeRelauncher); +workbenchRegistry.registerWorkbenchContribution(SettingsChangeRelauncher, LifecyclePhase.Running); diff --git a/src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts b/src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts index b5465c83f69..43ae1f24075 100644 --- a/src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts +++ b/src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts @@ -18,6 +18,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import { StatusUpdater, StatusBarController } from './scmActivity'; import { SCMViewlet } from 'vs/workbench/parts/scm/electron-browser/scmViewlet'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; class OpenSCMViewletAction extends ToggleViewletAction { @@ -30,7 +31,7 @@ class OpenSCMViewletAction extends ToggleViewletAction { } Registry.as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(DirtyDiffWorkbenchController); + .registerWorkbenchContribution(DirtyDiffWorkbenchController, LifecyclePhase.Starting); const viewletDescriptor = new ViewletDescriptor( SCMViewlet, @@ -44,10 +45,10 @@ Registry.as(ViewletExtensions.Viewlets) .registerViewlet(viewletDescriptor); Registry.as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(StatusUpdater); + .registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Starting); Registry.as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(StatusBarController); + .registerWorkbenchContribution(StatusBarController, LifecyclePhase.Starting); // Register Action to Open Viewlet Registry.as(WorkbenchActionExtensions.WorkbenchActions).registerWorkbenchAction( diff --git a/src/vs/workbench/parts/search/browser/replaceContributions.ts b/src/vs/workbench/parts/search/browser/replaceContributions.ts index 8dd1c346aa3..2a0f463fa68 100644 --- a/src/vs/workbench/parts/search/browser/replaceContributions.ts +++ b/src/vs/workbench/parts/search/browser/replaceContributions.ts @@ -7,8 +7,9 @@ import { IReplaceService } from 'vs/workbench/parts/search/common/replace'; import { ReplaceService, ReplacePreviewContentProvider } from 'vs/workbench/parts/search/browser/replaceService'; import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; export function registerContributions(): void { registerSingleton(IReplaceService, ReplaceService); - Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ReplacePreviewContentProvider); + Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ReplacePreviewContentProvider, LifecyclePhase.Starting); } diff --git a/src/vs/workbench/parts/surveys/electron-browser/languageSurveys.contribution.ts b/src/vs/workbench/parts/surveys/electron-browser/languageSurveys.contribution.ts index 3fa92e9391e..3d11116b925 100644 --- a/src/vs/workbench/parts/surveys/electron-browser/languageSurveys.contribution.ts +++ b/src/vs/workbench/parts/surveys/electron-browser/languageSurveys.contribution.ts @@ -19,6 +19,7 @@ import { FileChangeType, IFileService } from 'vs/platform/files/common/files'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import pkg from 'vs/platform/node/package'; import product, { ISurveyData } from 'vs/platform/node/product'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; class LanguageSurvey { @@ -144,5 +145,5 @@ class LanguageSurveysContribution implements IWorkbenchContribution { if (language === 'en' && product.surveys && product.surveys.length) { const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); - workbenchRegistry.registerWorkbenchContribution(LanguageSurveysContribution); + workbenchRegistry.registerWorkbenchContribution(LanguageSurveysContribution, LifecyclePhase.Running); } \ No newline at end of file diff --git a/src/vs/workbench/parts/surveys/electron-browser/nps.contribution.ts b/src/vs/workbench/parts/surveys/electron-browser/nps.contribution.ts index d9d5f68a579..c7b3a8bdda7 100644 --- a/src/vs/workbench/parts/surveys/electron-browser/nps.contribution.ts +++ b/src/vs/workbench/parts/surveys/electron-browser/nps.contribution.ts @@ -17,6 +17,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import pkg from 'vs/platform/node/package'; import product from 'vs/platform/node/product'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; const PROBABILITY = 0.15; const SESSION_COUNT_KEY = 'nps/sessionCount'; @@ -96,5 +97,5 @@ class NPSContribution implements IWorkbenchContribution { if (language === 'en' && product.npsSurveyUrl) { const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); - workbenchRegistry.registerWorkbenchContribution(NPSContribution); + workbenchRegistry.registerWorkbenchContribution(NPSContribution, LifecyclePhase.Running); } \ No newline at end of file diff --git a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts index 8dd635eb099..16084fe01e6 100644 --- a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts +++ b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts @@ -2384,8 +2384,6 @@ statusbarRegistry.registerStatusbarItem(new StatusbarItemDescriptor(TaskStatusBa let outputChannelRegistry = Registry.as(OutputExt.OutputChannels); outputChannelRegistry.registerChannel(TaskService.OutputChannelId, TaskService.OutputChannelLabel); -// (Registry.as(WorkbenchExtensions.Workbench)).registerWorkbenchContribution(TaskServiceParticipant); - // tasks.json validation let schemaId = 'vscode://schemas/tasks'; let schema: IJSONSchema = { diff --git a/src/vs/workbench/parts/trust/electron-browser/unsupportedWorkspaceSettings.contribution.ts b/src/vs/workbench/parts/trust/electron-browser/unsupportedWorkspaceSettings.contribution.ts index 86ba85f8e0b..0e3b5756886 100644 --- a/src/vs/workbench/parts/trust/electron-browser/unsupportedWorkspaceSettings.contribution.ts +++ b/src/vs/workbench/parts/trust/electron-browser/unsupportedWorkspaceSettings.contribution.ts @@ -11,7 +11,7 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { Action } from 'vs/base/common/actions'; import { IWorkbenchContributionsRegistry, IWorkbenchContribution, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { Registry } from 'vs/platform/registry/common/platform'; -import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; +import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { IMessageService, Severity } from 'vs/platform/message/common/message'; import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences'; import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration'; @@ -110,4 +110,4 @@ class UnsupportedWorkspaceSettingsContribution implements IWorkbenchContribution } const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); -workbenchRegistry.registerWorkbenchContribution(UnsupportedWorkspaceSettingsContribution); +workbenchRegistry.registerWorkbenchContribution(UnsupportedWorkspaceSettingsContribution, LifecyclePhase.Running); diff --git a/src/vs/workbench/parts/update/electron-browser/update.contribution.ts b/src/vs/workbench/parts/update/electron-browser/update.contribution.ts index 55cbb08c38f..d93239ac3ca 100644 --- a/src/vs/workbench/parts/update/electron-browser/update.contribution.ts +++ b/src/vs/workbench/parts/update/electron-browser/update.contribution.ts @@ -18,13 +18,14 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; import { ShowCurrentReleaseNotesAction, ProductContribution, UpdateContribution, Win3264BitContribution } from './update'; import { EditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; Registry.as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(ProductContribution); + .registerWorkbenchContribution(ProductContribution, LifecyclePhase.Running); if (process.platform === 'win32' && process.arch === 'ia32') { Registry.as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(Win3264BitContribution); + .registerWorkbenchContribution(Win3264BitContribution, LifecyclePhase.Running); } Registry.as(GlobalActivityExtensions) diff --git a/src/vs/workbench/parts/watermark/electron-browser/watermark.ts b/src/vs/workbench/parts/watermark/electron-browser/watermark.ts index 71c6932203c..70f3784bf1c 100644 --- a/src/vs/workbench/parts/watermark/electron-browser/watermark.ts +++ b/src/vs/workbench/parts/watermark/electron-browser/watermark.ts @@ -118,12 +118,10 @@ export class WatermarkContribution implements IWorkbenchContribution { this.workbenchState = contextService.getWorkbenchState(); lifecycleService.onShutdown(this.dispose, this); - lifecycleService.when(LifecyclePhase.Running).then(() => { - this.enabled = this.configurationService.getValue(WORKBENCH_TIPS_ENABLED_KEY); - if (this.enabled) { - this.create(); - } - }); + this.enabled = this.configurationService.getValue(WORKBENCH_TIPS_ENABLED_KEY); + if (this.enabled) { + this.create(); + } this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => { if (e.affectsConfiguration(WORKBENCH_TIPS_ENABLED_KEY)) { const enabled = this.configurationService.getValue(WORKBENCH_TIPS_ENABLED_KEY); @@ -212,7 +210,7 @@ export class WatermarkContribution implements IWorkbenchContribution { } Registry.as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(WatermarkContribution); + .registerWorkbenchContribution(WatermarkContribution, LifecyclePhase.Running); Registry.as(ConfigurationExtensions.Configuration) .registerConfiguration({ diff --git a/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts b/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts index 26ad4b85ab9..b088515c704 100644 --- a/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts +++ b/src/vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts @@ -7,7 +7,8 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { GettingStarted } from './gettingStarted'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; Registry .as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(GettingStarted); \ No newline at end of file + .registerWorkbenchContribution(GettingStarted, LifecyclePhase.Running); \ No newline at end of file diff --git a/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.contribution.ts b/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.contribution.ts index f6ab21bbef8..2e5f8844e43 100644 --- a/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.contribution.ts +++ b/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.contribution.ts @@ -12,6 +12,7 @@ import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/wor import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; import { IEditorInputFactoryRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; Registry.as(ConfigurationExtensions.Configuration) .registerConfiguration({ @@ -34,7 +35,7 @@ Registry.as(ConfigurationExtensions.Configuration) }); Registry.as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(WelcomePageContribution); + .registerWorkbenchContribution(WelcomePageContribution, LifecyclePhase.Running); Registry.as(ActionExtensions.WorkbenchActions) .registerWorkbenchAction(new SyncActionDescriptor(WelcomePageAction, WelcomePageAction.ID, WelcomePageAction.LABEL), 'Help: Welcome', localize('help', "Help")); diff --git a/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts b/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts index 5e28d965e40..f1d893f88ea 100644 --- a/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts +++ b/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts @@ -28,7 +28,7 @@ import { IMessageService, Severity, CloseAction } from 'vs/platform/message/comm import { getInstalledExtensions, IExtensionStatus, onExtensionChanged, isKeymapExtension } from 'vs/workbench/parts/extensions/electron-browser/extensionsUtils'; import { IExtensionEnablementService, IExtensionManagementService, IExtensionGalleryService, IExtensionTipsService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { used } from 'vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page'; -import { ILifecycleService, StartupKind, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; +import { ILifecycleService, StartupKind } from 'vs/platform/lifecycle/common/lifecycle'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { tildify } from 'vs/base/common/labels'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; @@ -58,10 +58,7 @@ export class WelcomePageContribution implements IWorkbenchContribution { ) { const enabled = isWelcomePageEnabled(configurationService); if (enabled && lifecycleService.startupKind !== StartupKind.ReloadedWindow) { - TPromise.join([ - backupFileService.hasBackups(), - lifecycleService.when(LifecyclePhase.Running) - ]).then(([hasBackups]) => { + backupFileService.hasBackups().then(hasBackups => { const activeInput = editorService.getActiveEditorInput(); if (!activeInput && !hasBackups) { return instantiationService.createInstance(WelcomePage) diff --git a/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThrough.contribution.ts b/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThrough.contribution.ts index 3c296f9ee5e..34735d73d31 100644 --- a/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThrough.contribution.ts +++ b/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThrough.contribution.ts @@ -20,6 +20,7 @@ import { KeyCode } from 'vs/base/common/keyCodes'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IEditorRegistry, Extensions as EditorExtensions, EditorDescriptor } from 'vs/workbench/browser/editor'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; Registry.as(EditorExtensions.Editors) .registerEditor(new EditorDescriptor( @@ -37,10 +38,10 @@ Registry.as(Extensions.WorkbenchActions) Registry.as(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(EditorWalkThroughInputFactory.ID, EditorWalkThroughInputFactory); Registry.as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(WalkThroughContentProvider); + .registerWorkbenchContribution(WalkThroughContentProvider, LifecyclePhase.Starting); Registry.as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(WalkThroughSnippetContentProvider); + .registerWorkbenchContribution(WalkThroughSnippetContentProvider, LifecyclePhase.Starting); Registry.as(Extensions.WorkbenchActions) .registerWorkbenchAction(new SyncActionDescriptor(WalkThroughArrowUpAction, WalkThroughArrowUpAction.ID, WalkThroughArrowUpAction.LABEL, { primary: KeyCode.UpArrow }, ContextKeyExpr.and(WALK_THROUGH_FOCUS, EditorContextKeys.textFocus.toNegated())), 'Interactive Playground: Scroll Up (Line)', localize('interactivePlayground', "Interactive Playground")); -- GitLab