diff --git a/vscode/src/client.ts b/vscode/src/client.ts index a5598a960..9def4acea 100644 --- a/vscode/src/client.ts +++ b/vscode/src/client.ts @@ -41,6 +41,15 @@ import { WorkspaceChannel } from "./workspaceChannel"; type EnabledFeatures = Record; +interface ServerErrorTelemetryEvent { + type: "error"; + errorMessage: string; + errorClass: string; + stack: string; +} + +type ServerTelemetryEvent = ServerErrorTelemetryEvent; + // Get the executables to start the server based on the user's configuration function getLspExecutables( workspaceFolder: vscode.WorkspaceFolder, @@ -319,6 +328,19 @@ export default class Client extends LanguageClient implements ClientInterface { params.textDocument.text, ); }); + + this.onTelemetry((event: ServerTelemetryEvent) => { + if (event.type === "error") { + this.telemetry.logError( + { + message: event.errorMessage, + name: event.errorClass, + stack: event.stack, + }, + { serverVersion: this.serverVersion }, + ); + } + }); } async afterStart() {