-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process telemetry from language server
- Loading branch information
1 parent
a19ba55
commit d993605
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import TelemetryReporter from 'vscode-extension-telemetry'; | ||
import { BaseLanguageClient, ClientCapabilities, StaticFeature } from 'vscode-languageclient'; | ||
|
||
const TELEMETRY_VERSION = 1; | ||
|
||
type TelemetryEvent = { | ||
v: number; | ||
name: string; | ||
properties: { string }; | ||
}; | ||
|
||
export class TelemetryFeature implements StaticFeature { | ||
constructor(private client: BaseLanguageClient, private reporter: TelemetryReporter) { | ||
this.client.onTelemetry((event: TelemetryEvent) => { | ||
if (event.v != TELEMETRY_VERSION) { | ||
console.log(`unsupported telemetry event: ${event}`); | ||
return; | ||
} | ||
|
||
reporter.sendRawTelemetryEvent(event.name, event.properties); | ||
}); | ||
} | ||
|
||
public fillClientCapabilities(capabilities: ClientCapabilities): void { | ||
if (!capabilities['experimental']) { | ||
capabilities['experimental'] = {}; | ||
} | ||
capabilities['experimental']['telemetryVersion'] = TELEMETRY_VERSION; | ||
} | ||
|
||
public initialize(): void { | ||
return; | ||
} | ||
|
||
public dispose(): void { | ||
return; | ||
} | ||
} |