提交 0697316d 编写于 作者: J Johannes Rieken

don't mention locale for now, make env a namespace and move to namespace...

don't mention locale for now, make env a namespace and move to namespace region, make sure env exists event in case of telemetry failure
上级 86ecfe84
......@@ -12,25 +12,7 @@ declare namespace vscode {
/**
* The version of the editor.
*/
export var version: string;
export const env: {
/**
* locale, like de-ch, en-us
*/
locale: string;
/**
* A unique UUID that identifies the machine
*/
machineId: string;
/**
* A unique UUID that identifies the session
*/
sessionId: string;
}
export const version: string;
/**
* Represents a reference to a command. Provides a title which
......@@ -2674,6 +2656,23 @@ declare namespace vscode {
update(key: string, value: any): Thenable<void>;
}
/**
* Namespace describing the environment the editor runs in.
*/
export namespace env {
/**
* A unique identifier for the computer.
*/
export let machineId: string;
/**
* A unique identifier for the current session.
* Changes each time the editor is started.
*/
export let sessionId: string;
}
/**
* Namespace for dealing with commands. In short, a command is a function with a
* unique identifier. The function is sometimes also called _command handler_.
......
......@@ -55,7 +55,6 @@ export class ExtHostAPIImplementation {
private _threadService: IThreadService;
private _proxy: MainProcessVSCodeAPIHelper;
private _pluginService: IPluginService;
private _telemetryService: ITelemetryService;
version: typeof vscode.version;
env: typeof vscode.env;
......@@ -100,18 +99,9 @@ export class ExtHostAPIImplementation {
) {
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;
......@@ -151,6 +141,17 @@ export class ExtHostAPIImplementation {
const pluginHostStatusBar = new ExtHostStatusBar(this._threadService);
const extHostOutputService = new ExtHostOutputService(this._threadService);
// env namespace
this.env = {
machineId: undefined,
sessionId: undefined,
// locale: undefined
}
telemetryService.getTelemetryInfo().then(info => {
this.env.machineId = info.machineId;
this.env.sessionId = info.sessionId;
}, errors.onUnexpectedError);
// commands namespace
this.commands = {
registerCommand<T>(id: string, command: <T>(...args: any[]) => T | Thenable<T>, thisArgs?: any): vscode.Disposable {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册