import * as vscode from "vscode" ; import { addContextProperty , sendInfo } from "vscode-extension-telemetry-wrapper" ; import { getExperimentationServiceAsync , IExperimentationService , IExperimentationTelemetry , TargetPopulation } from "vscode-tas-client" ; class ExperimentationTelemetry implements IExperimentationTelemetry { public setSharedProperty ( name , value ) { addContextProperty ( name , value ) ; } public postEvent ( eventName , props ) { const payload = { __event_name__ : eventName } ; for ( const [ key , value ] of props ) { payload [ key ] = value ; } sendInfo ( "" , payload ) ; } } let expService ; export function getExpService ( ) { return expService ; } export async function init ( context ) { const packageJson = require ( "../package.json" ) ; const extensionName = `${ packageJson [ "publisher" ] }.${ packageJson [ "name" ] }` ; const extensionVersion = packageJson [ "version" ] ; expService = await getExperimentationServiceAsync ( extensionName , extensionVersion , TargetPopulation . Public , new ExperimentationTelemetry ( ) , context . globalState ) ; }