LspClient

Struct LspClient 

Source
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: Handle

The tokio handle.

§sender: TransportHost

The TransportHost between LspClient and LspServer

Implementations§

Source§

impl LspClient

Source

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.

Source

pub fn respond_lsp(&self, response: Response)

Completes an client2server request in the request queue.

Source

pub fn send_notification<N: Notif>(&self, params: &N::Params)

Sends a typed notification to the client.

Source

pub fn send_notification_(&self, notif: Notification)

Sends an untyped notification to the client.

Source§

impl LspClient

Source

pub fn untyped(&self) -> &Self

Returns the untyped lsp client.

Source

pub fn to_typed<S: Any>(&self) -> TypedLspClient<S>

converts the client to a typed client.

Source

pub fn has_pending_requests(&self) -> bool

Checks if there are pending requests.

Source

pub fn begin_panic(&self)

Prints states of the request queue and panics.

Source

pub fn send_event<T: Any + Send + 'static>(&self, event: T)

Sends a event to the server itself.

Source

pub fn complete_lsp_request<S: Any>(&self, service: &mut S, response: Response)

Completes an server2client request in the request queue.

Source

pub fn complete_dap_request<S: Any>(&self, service: &mut S, response: Response)

Completes an server2client request in the request queue.

Source

pub fn register_request( &self, method: &str, id: &RequestId, received_at: Instant, )

Registers an client2server request in the request queue.

Source

pub fn respond(&self, id: RequestId, response: Message)

Completes an client2server request in the request queue.

Source§

impl LspClient

Source

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(()).

Trait Implementations§

Source§

impl Clone for LspClient

Source§

fn clone(&self) -> LspClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LspClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<S, T> ArcInto<T> for S
where Arc<S>: Into<T>,

Source§

fn arc_into(self: Arc<S>) -> T

Converts Arc<T> into Self.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.