pub struct LspClient {
pub handle: Handle,
pub sender: TransportHost,
/* private fields */
}Expand description
The host for the language server, or known as the LSP client.
Fields§
§handle: HandleThe tokio handle.
sender: TransportHostThe TransportHost between LspClient and LspServer
Implementations§
Source§impl LspClient
impl LspClient
Sourcepub fn send_lsp_request_<R: Req>(
&self,
params: R::Params,
handler: impl FnOnce(&mut dyn Any, Response) + Send + Sync + 'static,
)
pub fn send_lsp_request_<R: Req>( &self, params: R::Params, handler: impl FnOnce(&mut dyn Any, Response) + Send + Sync + 'static, )
Sends a request to the client and registers a handler.
Sourcepub fn respond_lsp(&self, response: Response)
pub fn respond_lsp(&self, response: Response)
Completes an client2server request in the request queue.
Sourcepub fn send_notification<N: Notif>(&self, params: &N::Params)
pub fn send_notification<N: Notif>(&self, params: &N::Params)
Sends a typed notification to the client.
Sourcepub fn send_notification_(&self, notif: Notification)
pub fn send_notification_(&self, notif: Notification)
Sends an untyped notification to the client.
Source§impl LspClient
impl LspClient
Sourcepub fn to_typed<S: Any>(&self) -> TypedLspClient<S>
pub fn to_typed<S: Any>(&self) -> TypedLspClient<S>
converts the client to a typed client.
Sourcepub fn has_pending_requests(&self) -> bool
pub fn has_pending_requests(&self) -> bool
Checks if there are pending requests.
Sourcepub fn begin_panic(&self)
pub fn begin_panic(&self)
Prints states of the request queue and panics.
Sourcepub fn send_event<T: Any + Send + 'static>(&self, event: T)
pub fn send_event<T: Any + Send + 'static>(&self, event: T)
Sends a event to the server itself.
Sourcepub fn complete_lsp_request<S: Any>(&self, service: &mut S, response: Response)
pub fn complete_lsp_request<S: Any>(&self, service: &mut S, response: Response)
Completes an server2client request in the request queue.
Sourcepub fn complete_dap_request<S: Any>(&self, service: &mut S, response: Response)
pub fn complete_dap_request<S: Any>(&self, service: &mut S, response: Response)
Completes an server2client request in the request queue.
Sourcepub fn register_request(
&self,
method: &str,
id: &RequestId,
received_at: Instant,
)
pub fn register_request( &self, method: &str, id: &RequestId, received_at: Instant, )
Registers an client2server request in the request queue.
Source§impl LspClient
impl LspClient
Sourcepub async fn schedule_tail(self, req_id: RequestId, resp: ScheduleResult)
pub async fn schedule_tail(self, req_id: RequestId, resp: ScheduleResult)
Finally sends the response if it is not sent before.
From the definition, the response is already sent if it is Some(()).