import * as vscode from 'vscode' ; interface IPackageInfo { name : string ; version : string ; aiKey : string ; } export interface TelemetryReporter { dispose ( ) : void ; sendTelemetryEvent ( eventName , properties ? ) : void ; } const nullReporter = new class NullTelemetryReporter implements TelemetryReporter { sendTelemetryEvent ( ) { } dispose ( ) { } } ; class ExtensionReporter implements TelemetryReporter { constructor ( _packageInfo ) { } sendTelemetryEvent ( _eventName , _properties ? ) { } dispose ( ) { } } export function loadDefaultTelemetryReporter ( ) { const packageInfo = getPackageInfo ( ) ; return packageInfo ? new ExtensionReporter ( packageInfo ) : nullReporter ; } function getPackageInfo ( ) { const extension = vscode . extensions . getExtension ( 'Microsoft.vscode-markdown' ) ; if ( extension && extension . packageJSON ) { return { name : extension . packageJSON . name , version : extension . packageJSON . version , aiKey : extension . packageJSON . aiKey } ; } return null ; }