sync_lsp/window/telemetry.rs
1//! implementation of the `window/telemetry` notification.
2//!
3//! # Usage
4//! [`Connection::telemetry`] sends arbitrary telemetry data to the client.
5
6use serde::Serialize;
7use crate::{Connection, TypeProvider};
8use crate::connection::RpcConnection;
9
10#[derive(Default)]
11pub(super) struct Telemetry;
12
13impl<T: TypeProvider> Connection<T> {
14
15 /// This notification sends arbitrary [telemetry data](self) to the client.
16 ///
17 /// # Arguments
18 /// * `params` - The data to send.
19
20 pub fn telemetry(&mut self, params: impl Serialize) {
21 self.notify(
22 Telemetry::METHOD,
23 params
24 );
25 }
26}
27
28impl Telemetry {
29 const METHOD: &'static str = "telemetry/event";
30}