Adding a global Env to the extension API

This commit is contained in:
Sofian Hnaide
2016-01-20 16:28:56 -08:00
parent 3330e7e20e
commit 2f8e58409c
3 changed files with 41 additions and 11 deletions

View File

@@ -39,6 +39,7 @@ import {CancellationTokenSource} from 'vs/base/common/cancellation';
import vscode = require('vscode');
import {TextEditorRevealType} from 'vs/workbench/api/node/mainThreadEditors';
import * as paths from 'vs/base/common/paths';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
/**
* This class implements the API described in vscode.d.ts,
@@ -54,8 +55,9 @@ export class ExtHostAPIImplementation {
private _threadService: IThreadService;
private _proxy: MainProcessVSCodeAPIHelper;
private _pluginService: IPluginService;
private _telemetryService: ITelemetryService;
version: typeof vscode.version;
env: typeof vscode.env;
Uri: typeof vscode.Uri;
Location: typeof vscode.Location;
Diagnostic: typeof vscode.Diagnostic;
@@ -92,13 +94,23 @@ export class ExtHostAPIImplementation {
constructor(
@IThreadService threadService: IThreadService,
@IPluginService pluginService: IPluginService,
@IWorkspaceContextService contextService: IWorkspaceContextService
@IWorkspaceContextService contextService: IWorkspaceContextService,
@ITelemetryService telemetryService: ITelemetryService
) {
this._pluginService = pluginService;
this._threadService = threadService;
this._telemetryService = telemetryService;
this._proxy = threadService.getRemotable(MainProcessVSCodeAPIHelper);
this.version = contextService.getConfiguration().env.version;
this._telemetryService.getTelemetryInfo().then((info) => {
this.env = {
version:contextService.getConfiguration().env.version,
machineId: info.machineId,
sessionId: info.sessionId,
locale: null
}
});
this.Uri = URI;
this.Location = extHostTypes.Location;
this.Diagnostic = <any> extHostTypes.Diagnostic;