import { IConnection } from "vscode-languageserver" ; export interface AnalyticsPayload { action : string ; attributes : { [ key ] : any ; } ; } export interface ExceptionPayload { message : string ; stack : string ; } let connection = void 0 ; export const initializeAnalytics = ( serverConnection ) => { connection = serverConnection ; } ; export const sendAnalytics = ( payload ) => { if ( connection ) { connection . sendNotification ( "custom/analytics" , payload ) ; } } ; export const sendException = ( error , message = "" ) => { if ( connection ) { connection . sendNotification ( "custom/analytics" , { message : `${ message }: ${ error . message }` , stack : error . stack } ) ; } } ;