Merge pull request #2136 from SofianHn/master

Adding a global Env to the extension API
This commit is contained in:
Sofian Hnaide
2016-01-21 11:40:34 -08:00
3 changed files with 36 additions and 5 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,10 @@ 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 +95,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 = {
machineId: info.machineId,
sessionId: info.sessionId,
locale: null
}
});
this.Uri = URI;
this.Location = extHostTypes.Location;
this.Diagnostic = <any> extHostTypes.Diagnostic;