forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtelemetry.ts
More file actions
28 lines (24 loc) · 1.04 KB
/
telemetry.ts
File metadata and controls
28 lines (24 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
// tslint:disable-next-line:no-reference
/// <reference path="./vscode-extension-telemetry.d.ts" />
import { extensions } from 'vscode';
// tslint:disable-next-line:import-name
import TelemetryReporter from 'vscode-extension-telemetry';
// tslint:disable-next-line:no-any
let telemetryReporter: TelemetryReporter;
export function getTelemetryReporter() {
if (telemetryReporter) {
return telemetryReporter;
}
const extensionId = 'ms-python.python';
// tslint:disable-next-line:no-non-null-assertion
const extension = extensions.getExtension(extensionId)!;
// tslint:disable-next-line:no-unsafe-any
const extensionVersion = extension.packageJSON.version;
// tslint:disable-next-line:no-unsafe-any
const aiKey = extension.packageJSON.contributes.debuggers[0].aiKey;
// tslint:disable-next-line:no-unsafe-any
return telemetryReporter = new TelemetryReporter(extensionId, extensionVersion, aiKey);
}