提交 79f3ea1e 编写于 作者: B Benjamin Pasero

startup - convert more to workbench contributions

上级 ecb2beb5
......@@ -67,7 +67,6 @@ import { WorkbenchModeServiceImpl } from 'vs/workbench/services/mode/common/work
import { IModeService } from 'vs/editor/common/services/modeService';
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { ICrashReporterService, NullCrashReporterService, CrashReporterService } from 'vs/workbench/services/crashReporter/electron-browser/crashReporterService';
import { NodeCachedDataManager } from 'vs/workbench/electron-browser/nodeCachedDataManager';
import { getDelayedChannel } from 'vs/base/parts/ipc/common/ipc';
import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net';
import { IExtensionManagementChannel, ExtensionManagementChannelClient } from 'vs/platform/extensionManagement/common/extensionManagementIpc';
......@@ -253,11 +252,7 @@ export class WorkbenchShell {
this.messageService.show(Severity.Warning, nls.localize('runningAsRoot', "It is recommended not to run Code as 'root'."));
}
// Start cached data manager
instantiationService.createInstance(NodeCachedDataManager);
// Set lifecycle phase to `Runnning` so that other contributions
// can now do something
// Set lifecycle phase to `Runnning` so that other contributions can now do something
this.lifecycleService.phase = LifecyclePhase.Running;
}
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { NodeCachedDataManager } from 'vs/workbench/parts/cache/node/nodeCachedDataManager';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
// Register NodeCachedDataManager Contribution
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(NodeCachedDataManager, LifecyclePhase.Running);
\ No newline at end of file
......@@ -6,21 +6,26 @@
import { basename } from 'path';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
declare type OnNodeCachedDataArgs = [{ errorCode: string, path: string, detail?: string }, { path: string, length: number }];
declare const MonacoEnvironment: { onNodeCachedData: OnNodeCachedDataArgs[] };
export class NodeCachedDataManager {
export class NodeCachedDataManager implements IWorkbenchContribution {
private readonly _telemetryService: ITelemetryService;
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@ITelemetryService telemetryService: ITelemetryService
) {
this._telemetryService = telemetryService;
this._handleCachedDataInfo();
}
public getId(): string {
return 'vs.cache.nodeCachedDataManager';
}
private _handleCachedDataInfo(): void {
let didRejectCachedData = false;
......
......@@ -7,8 +7,8 @@
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { WorkspaceStatsReporter } from 'vs/workbench/parts/stats/node/workspaceStats';
import { WorkspaceStats } from 'vs/workbench/parts/stats/node/workspaceStats';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
// Register Workspace Stats Contribution
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(WorkspaceStatsReporter, LifecyclePhase.Running);
\ No newline at end of file
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(WorkspaceStats, LifecyclePhase.Running);
\ No newline at end of file
......@@ -15,7 +15,6 @@ import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWindowConfiguration, IWindowService } from 'vs/platform/windows/common/windows';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
const SshProtocolMatcher = /^([^@:]+@)?([^:]+):/;
const SshUrlMatcher = /^([^@:]+@)?([^:]+):(.+)$/;
......@@ -133,13 +132,20 @@ export function getHashedRemotes(text: string): string[] {
});
}
class WorkspaceStats {
export class WorkspaceStats implements IWorkbenchContribution {
constructor(
@IFileService private fileService: IFileService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@ITelemetryService private telemetryService: ITelemetryService,
@IEnvironmentService private environmentService: IEnvironmentService
@IEnvironmentService private environmentService: IEnvironmentService,
@IWindowService windowService: IWindowService
) {
this.reportWorkspaceTags(windowService.getConfiguration());
this.reportCloudStats();
}
public getId(): string {
return 'vs.stats.workspaceStatsReporter';
}
private searchArray(arr: string[], regEx: RegExp): boolean {
......@@ -415,25 +421,4 @@ class WorkspaceStats {
this.reportAzure(uris);
}
}
}
// Telemetry: workspace tags
export class WorkspaceStatsReporter implements IWorkbenchContribution {
constructor(
@IInstantiationService private instantiationService: IInstantiationService,
@IWindowService private windowService: IWindowService
) {
this.reportWorkspaceStats();
}
public getId(): string {
return 'vs.backup.backupModelTracker';
}
private reportWorkspaceStats(): void {
const workspaceStats: WorkspaceStats = this.instantiationService.createInstance(WorkspaceStats);
workspaceStats.reportWorkspaceTags(this.windowService.getConfiguration());
workspaceStats.reportCloudStats();
}
}
\ No newline at end of file
......@@ -43,6 +43,7 @@ import 'vs/workbench/parts/files/browser/files.contribution';
import 'vs/workbench/parts/backup/common/backup.contribution';
import 'vs/workbench/parts/stats/node/stats.contribution';
import 'vs/workbench/parts/cache/node/cache.contribution';
import 'vs/workbench/parts/search/browser/search.contribution';
import 'vs/workbench/parts/search/browser/searchViewlet'; // can be packaged separately
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册