git: telemetry events

This commit is contained in:
Joao Moreno
2017-02-20 19:32:21 +01:00
parent 9ae2575f95
commit 5c4923b25d
4 changed files with 24 additions and 8 deletions

View File

@@ -15,11 +15,15 @@ import { GitContentProvider } from './contentProvider';
import { AutoFetcher } from './autofetch';
import { MergeDecorator } from './merge';
import { Askpass } from './askpass';
import TelemetryReporter from 'vscode-extension-telemetry';
import * as nls from 'vscode-nls';
const localize = nls.config()();
async function init(disposables: Disposable[]): Promise<void> {
async function init(context: ExtensionContext, disposables: Disposable[]): Promise<void> {
const { name, version, aiKey } = require(context.asAbsolutePath('./package.json')) as { name: string, version: string, aiKey: string };
const telemetryReporter: TelemetryReporter = new TelemetryReporter(name, version, aiKey);
const outputChannel = window.createOutputChannel('Git');
disposables.push(outputChannel);
@@ -28,7 +32,7 @@ async function init(disposables: Disposable[]): Promise<void> {
const rootPath = workspace.rootPath;
if (!rootPath || !enabled) {
const commandCenter = new CommandCenter(undefined, outputChannel);
const commandCenter = new CommandCenter(undefined, outputChannel, telemetryReporter);
disposables.push(commandCenter);
return;
}
@@ -42,7 +46,7 @@ async function init(disposables: Disposable[]): Promise<void> {
outputChannel.appendLine(localize('using git', "Using git {0} from {1}", info.version, info.path));
git.onOutput(str => outputChannel.append(str), null, disposables);
const commandCenter = new CommandCenter(model, outputChannel);
const commandCenter = new CommandCenter(model, outputChannel, telemetryReporter);
const provider = new GitSCMProvider(model, commandCenter);
const contentProvider = new GitContentProvider(model);
const checkoutStatusBar = new CheckoutStatusBar(model);
@@ -81,6 +85,6 @@ export function activate(context: ExtensionContext): any {
const disposables: Disposable[] = [];
context.subscriptions.push(new Disposable(() => Disposable.from(...disposables).dispose()));
init(disposables)
init(context, disposables)
.catch(err => console.error(err));
}