diff --git a/src/vs/platform/lifecycle/common/lifecycle.ts b/src/vs/platform/lifecycle/common/lifecycle.ts index 3f2cd9cde69c5716f70e7adc48efb29926d7cdc5..2e96135e9b65218111dbece19c90d9d46d2014e9 100644 --- a/src/vs/platform/lifecycle/common/lifecycle.ts +++ b/src/vs/platform/lifecycle/common/lifecycle.ts @@ -49,7 +49,8 @@ export enum LifecyclePhase { Starting = 1, Restoring = 2, Running = 3, - ShuttingDown = 4 + RunningForABit = 4, + ShuttingDown = 5 } /** diff --git a/src/vs/workbench/common/contributions.ts b/src/vs/workbench/common/contributions.ts index 23ca3ad3cb2219d7035ed1d417947e05ccc2f622..e826e15728220a186216a4f3e24b9f92a1a74ed4 100644 --- a/src/vs/workbench/common/contributions.ts +++ b/src/vs/workbench/common/contributions.ts @@ -72,7 +72,7 @@ export class WorkbenchContributionsRegistry implements IWorkbenchContributionsRe this.instantiationService = instantiationService; this.lifecycleService = lifecycleService; - [LifecyclePhase.Starting, LifecyclePhase.Restoring, LifecyclePhase.Running, LifecyclePhase.ShuttingDown].forEach(phase => { + [LifecyclePhase.Starting, LifecyclePhase.Restoring, LifecyclePhase.Running, LifecyclePhase.RunningForABit, LifecyclePhase.ShuttingDown].forEach(phase => { this.instantiateByPhase(instantiationService, lifecycleService, phase); }); } diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index ee48fc9392b7568a6bdf002ba46272968855135a..215dfaf1822c62e4dd1ec9a55d9b2324a5543b25 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -191,7 +191,32 @@ export class WorkbenchShell { private onWorkbenchStarted(info: IWorkbenchStartedInfo, instantiationService: IInstantiationService): void { - // Telemetry: workspace info + // Startup Telemetry + this.logStartupTelemetry(info); + + // Root Warning + if ((platform.isLinux || platform.isMacintosh) && process.getuid() === 0) { + this.messageService.show(Severity.Warning, nls.localize('runningAsRoot', "It is recommended not to run Code as 'root'.")); + } + + // Set lifecycle phase to `Runnning` so that other contributions can now do something + this.lifecycleService.phase = LifecyclePhase.Running; + + // Set lifecycle phase to `Runnning For A Bit` after a short delay + let timeoutHandle = setTimeout(() => { + timeoutHandle = void 0; + this.lifecycleService.phase = LifecyclePhase.RunningForABit; + }, 3000); + this.toUnbind.push({ + dispose: () => { + if (timeoutHandle) { + clearTimeout(timeoutHandle); + } + } + }); + } + + private logStartupTelemetry(info: IWorkbenchStartedInfo): void { const { filesToOpen, filesToCreate, filesToDiff } = this.configuration; /* __GDPR__ "workspaceLoad" : { @@ -246,14 +271,6 @@ export class WorkbenchShell { */ this.telemetryService.publicLog('startupTime', this.timerService.startupMetrics); }); - - // Root Warning - if ((platform.isLinux || platform.isMacintosh) && process.getuid() === 0) { - this.messageService.show(Severity.Warning, nls.localize('runningAsRoot', "It is recommended not to run Code as 'root'.")); - } - - // Set lifecycle phase to `Runnning` so that other contributions can now do something - this.lifecycleService.phase = LifecyclePhase.Running; } private initServiceCollection(container: HTMLElement): [IInstantiationService, ServiceCollection] { diff --git a/src/vs/workbench/parts/stats/node/stats.contribution.ts b/src/vs/workbench/parts/stats/node/stats.contribution.ts index 7b38d263cb9aefe7fdac979322aa31565e681400..1703314f9401b3be0556591a651b76d74d39b2c7 100644 --- a/src/vs/workbench/parts/stats/node/stats.contribution.ts +++ b/src/vs/workbench/parts/stats/node/stats.contribution.ts @@ -11,4 +11,4 @@ import { WorkspaceStats } from 'vs/workbench/parts/stats/node/workspaceStats'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; // Register Workspace Stats Contribution -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(WorkspaceStats, LifecyclePhase.Running); \ No newline at end of file +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(WorkspaceStats, LifecyclePhase.RunningForABit); \ No newline at end of file