mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-12 17:48:19 +01:00
adopt lifecycle phases for workbench contributions (fixes #38080)
This commit is contained in:
@@ -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<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(
|
||||
ExtensionPoints
|
||||
);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ExtensionPoints, LifecyclePhase.Starting);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(
|
||||
BackupModelTracker
|
||||
);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(BackupModelTracker, LifecyclePhase.Starting);
|
||||
|
||||
// Register Backup Restorer
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(
|
||||
BackupRestorer
|
||||
);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(BackupRestorer, LifecyclePhase.Starting);
|
||||
@@ -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<IWorkbenchActionRegistry>(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<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugEditorModelManager);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugActionsWidget);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugContentProvider);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(StatusBarColorProvider);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugEditorModelManager, LifecyclePhase.Starting);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugActionsWidget, LifecyclePhase.Starting);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugContentProvider, LifecyclePhase.Starting);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(StatusBarColorProvider, LifecyclePhase.Starting);
|
||||
|
||||
const debugCategory = nls.localize('debugCategory', "Debug");
|
||||
registry.registerWorkbenchAction(new SyncActionDescriptor(
|
||||
|
||||
@@ -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<IWorkbenchContributionsRegistry>(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<IOutputChannelRegistry>(OutputExtensions.OutputChannels)
|
||||
.registerChannel(ExtensionsChannelId, ExtensionsLabel);
|
||||
|
||||
@@ -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<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(FILE_EDITOR_INPUT_ID, FileEditorInputFactory);
|
||||
|
||||
// Register File Editor Tracker
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(
|
||||
FileEditorTracker
|
||||
);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(FileEditorTracker, LifecyclePhase.Starting);
|
||||
|
||||
// Register Save Error Handler
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(
|
||||
SaveErrorHandler
|
||||
);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(SaveErrorHandler, LifecyclePhase.Starting);
|
||||
|
||||
// Register Dirty Files Tracker
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(
|
||||
DirtyFilesTracker
|
||||
);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DirtyFilesTracker, LifecyclePhase.Starting);
|
||||
|
||||
// Configuration
|
||||
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
|
||||
|
||||
@@ -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<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(MarkersFileDecorations);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(MarkersFileDecorations, LifecyclePhase.Running);
|
||||
|
||||
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
|
||||
'id': 'problems',
|
||||
|
||||
@@ -31,10 +31,7 @@ class StartupProfiler implements IWorkbenchContribution {
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
) {
|
||||
// wait for everything to be ready
|
||||
TPromise.join<any>([
|
||||
lifecycleService.when(LifecyclePhase.Running),
|
||||
extensionService.onReady(),
|
||||
]).then(() => {
|
||||
extensionService.onReady().then(() => {
|
||||
this._stopProfiling();
|
||||
});
|
||||
}
|
||||
@@ -92,4 +89,4 @@ class StartupProfiler implements IWorkbenchContribution {
|
||||
}
|
||||
|
||||
const registry = Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench);
|
||||
registry.registerWorkbenchContribution(StartupProfiler);
|
||||
registry.registerWorkbenchContribution(StartupProfiler, LifecyclePhase.Running);
|
||||
|
||||
@@ -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<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(PreferencesContribution);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(PreferencesContribution, LifecyclePhase.Starting);
|
||||
|
||||
CommandsRegistry.registerCommand(OPEN_FOLDER_SETTINGS_COMMAND, function (accessor: ServicesAccessor, args?: IWorkspaceFolder) {
|
||||
const preferencesService = accessor.get(IPreferencesService);
|
||||
|
||||
@@ -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 = <IWorkbenchContributionsRegistry>Registry.as(WorkbenchExtensions.Workbench);
|
||||
workbenchRegistry.registerWorkbenchContribution(SettingsChangeRelauncher);
|
||||
workbenchRegistry.registerWorkbenchContribution(SettingsChangeRelauncher, LifecyclePhase.Running);
|
||||
|
||||
@@ -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<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(DirtyDiffWorkbenchController);
|
||||
.registerWorkbenchContribution(DirtyDiffWorkbenchController, LifecyclePhase.Starting);
|
||||
|
||||
const viewletDescriptor = new ViewletDescriptor(
|
||||
SCMViewlet,
|
||||
@@ -44,10 +45,10 @@ Registry.as<ViewletRegistry>(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<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions).registerWorkbenchAction(
|
||||
|
||||
@@ -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<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ReplacePreviewContentProvider);
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ReplacePreviewContentProvider, LifecyclePhase.Starting);
|
||||
}
|
||||
|
||||
@@ -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 = <IWorkbenchContributionsRegistry>Registry.as(WorkbenchExtensions.Workbench);
|
||||
workbenchRegistry.registerWorkbenchContribution(LanguageSurveysContribution);
|
||||
workbenchRegistry.registerWorkbenchContribution(LanguageSurveysContribution, LifecyclePhase.Running);
|
||||
}
|
||||
@@ -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 = <IWorkbenchContributionsRegistry>Registry.as(WorkbenchExtensions.Workbench);
|
||||
workbenchRegistry.registerWorkbenchContribution(NPSContribution);
|
||||
workbenchRegistry.registerWorkbenchContribution(NPSContribution, LifecyclePhase.Running);
|
||||
}
|
||||
@@ -2384,8 +2384,6 @@ statusbarRegistry.registerStatusbarItem(new StatusbarItemDescriptor(TaskStatusBa
|
||||
let outputChannelRegistry = <IOutputChannelRegistry>Registry.as(OutputExt.OutputChannels);
|
||||
outputChannelRegistry.registerChannel(TaskService.OutputChannelId, TaskService.OutputChannelLabel);
|
||||
|
||||
// (<IWorkbenchContributionsRegistry>Registry.as(WorkbenchExtensions.Workbench)).registerWorkbenchContribution(TaskServiceParticipant);
|
||||
|
||||
// tasks.json validation
|
||||
let schemaId = 'vscode://schemas/tasks';
|
||||
let schema: IJSONSchema = {
|
||||
|
||||
+2
-2
@@ -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 = <IWorkbenchContributionsRegistry>Registry.as(WorkbenchExtensions.Workbench);
|
||||
workbenchRegistry.registerWorkbenchContribution(UnsupportedWorkspaceSettingsContribution);
|
||||
workbenchRegistry.registerWorkbenchContribution(UnsupportedWorkspaceSettingsContribution, LifecyclePhase.Running);
|
||||
|
||||
@@ -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<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(ProductContribution);
|
||||
.registerWorkbenchContribution(ProductContribution, LifecyclePhase.Running);
|
||||
|
||||
if (process.platform === 'win32' && process.arch === 'ia32') {
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(Win3264BitContribution);
|
||||
.registerWorkbenchContribution(Win3264BitContribution, LifecyclePhase.Running);
|
||||
}
|
||||
|
||||
Registry.as<IGlobalActivityRegistry>(GlobalActivityExtensions)
|
||||
|
||||
@@ -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<boolean>(WORKBENCH_TIPS_ENABLED_KEY);
|
||||
if (this.enabled) {
|
||||
this.create();
|
||||
}
|
||||
});
|
||||
this.enabled = this.configurationService.getValue<boolean>(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<boolean>(WORKBENCH_TIPS_ENABLED_KEY);
|
||||
@@ -212,7 +210,7 @@ export class WatermarkContribution implements IWorkbenchContribution {
|
||||
}
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(WatermarkContribution);
|
||||
.registerWorkbenchContribution(WatermarkContribution, LifecyclePhase.Running);
|
||||
|
||||
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
||||
.registerConfiguration({
|
||||
|
||||
+2
-1
@@ -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<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(GettingStarted);
|
||||
.registerWorkbenchContribution(GettingStarted, LifecyclePhase.Running);
|
||||
@@ -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<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
||||
.registerConfiguration({
|
||||
@@ -34,7 +35,7 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
||||
});
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(WelcomePageContribution);
|
||||
.registerWorkbenchContribution(WelcomePageContribution, LifecyclePhase.Running);
|
||||
|
||||
Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions)
|
||||
.registerWorkbenchAction(new SyncActionDescriptor(WelcomePageAction, WelcomePageAction.ID, WelcomePageAction.LABEL), 'Help: Welcome', localize('help', "Help"));
|
||||
|
||||
@@ -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)
|
||||
|
||||
+3
-2
@@ -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<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(new EditorDescriptor(
|
||||
@@ -37,10 +38,10 @@ Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(EditorWalkThroughInputFactory.ID, EditorWalkThroughInputFactory);
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(WalkThroughContentProvider);
|
||||
.registerWorkbenchContribution(WalkThroughContentProvider, LifecyclePhase.Starting);
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(WalkThroughSnippetContentProvider);
|
||||
.registerWorkbenchContribution(WalkThroughSnippetContentProvider, LifecyclePhase.Starting);
|
||||
|
||||
Registry.as<IWorkbenchActionRegistry>(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"));
|
||||
|
||||
Reference in New Issue
Block a user