@@ -15,11 +15,15 @@ import { GitContentProvider } from './contentProvider';
1515import { AutoFetcher } from './autofetch' ;
1616import { MergeDecorator } from './merge' ;
1717import { Askpass } from './askpass' ;
18+ import TelemetryReporter from 'vscode-extension-telemetry' ;
1819import * as nls from 'vscode-nls' ;
1920
2021const localize = nls . config ( ) ( ) ;
2122
22- async function init ( disposables : Disposable [ ] ) : Promise < void > {
23+ async function init ( context : ExtensionContext , disposables : Disposable [ ] ) : Promise < void > {
24+ const { name, version, aiKey } = require ( context . asAbsolutePath ( './package.json' ) ) as { name : string , version : string , aiKey : string } ;
25+ const telemetryReporter : TelemetryReporter = new TelemetryReporter ( name , version , aiKey ) ;
26+
2327 const outputChannel = window . createOutputChannel ( 'Git' ) ;
2428 disposables . push ( outputChannel ) ;
2529
@@ -28,7 +32,7 @@ async function init(disposables: Disposable[]): Promise<void> {
2832 const rootPath = workspace . rootPath ;
2933
3034 if ( ! rootPath || ! enabled ) {
31- const commandCenter = new CommandCenter ( undefined , outputChannel ) ;
35+ const commandCenter = new CommandCenter ( undefined , outputChannel , telemetryReporter ) ;
3236 disposables . push ( commandCenter ) ;
3337 return ;
3438 }
@@ -42,7 +46,7 @@ async function init(disposables: Disposable[]): Promise<void> {
4246 outputChannel . appendLine ( localize ( 'using git' , "Using git {0} from {1}" , info . version , info . path ) ) ;
4347 git . onOutput ( str => outputChannel . append ( str ) , null , disposables ) ;
4448
45- const commandCenter = new CommandCenter ( model , outputChannel ) ;
49+ const commandCenter = new CommandCenter ( model , outputChannel , telemetryReporter ) ;
4650 const provider = new GitSCMProvider ( model , commandCenter ) ;
4751 const contentProvider = new GitContentProvider ( model ) ;
4852 const checkoutStatusBar = new CheckoutStatusBar ( model ) ;
@@ -81,6 +85,6 @@ export function activate(context: ExtensionContext): any {
8185 const disposables : Disposable [ ] = [ ] ;
8286 context . subscriptions . push ( new Disposable ( ( ) => Disposable . from ( ...disposables ) . dispose ( ) ) ) ;
8387
84- init ( disposables )
88+ init ( context , disposables )
8589 . catch ( err => console . error ( err ) ) ;
8690}
0 commit comments