sync_ls

Struct LsDriver

Source
pub struct LsDriver<M, Args: Initializer> {
    pub client: LspClient,
    pub events: HashMap<TypeId, Box<dyn for<'a> Fn(ServiceState<'a, Args, Args::S>, &LspClient, Event) -> Result<()>>>,
    pub commands: HashMap<&'static str, Box<dyn Fn(&mut Args::S, &LspClient, RequestId, Vec<Value>) -> ScheduledResult>>,
    pub notifications: HashMap<&'static str, Box<dyn Fn(&mut Args::S, Value) -> LspResult<()>>>,
    pub requests: HashMap<&'static str, Box<dyn Fn(&mut Args::S, &LspClient, RequestId, Value) -> ScheduledResult>>,
    pub resources: HashMap<Arc<Path>, Box<dyn Fn(&mut Args::S, &LspClient, RequestId, Vec<Value>) -> ScheduledResult>>,
    /* private fields */
}
Expand description

The language server driver.

Fields§

§client: LspClient

The language server client.

§events: HashMap<TypeId, Box<dyn for<'a> Fn(ServiceState<'a, Args, Args::S>, &LspClient, Event) -> Result<()>>>

Events for dispatching.

§commands: HashMap<&'static str, Box<dyn Fn(&mut Args::S, &LspClient, RequestId, Vec<Value>) -> ScheduledResult>>

Extra commands provided with textDocument/executeCommand.

§notifications: HashMap<&'static str, Box<dyn Fn(&mut Args::S, Value) -> LspResult<()>>>

Notifications for dispatching.

§requests: HashMap<&'static str, Box<dyn Fn(&mut Args::S, &LspClient, RequestId, Value) -> ScheduledResult>>

Requests for dispatching.

§resources: HashMap<Arc<Path>, Box<dyn Fn(&mut Args::S, &LspClient, RequestId, Vec<Value>) -> ScheduledResult>>

Resources for dispatching.

Implementations§

Source§

impl<Args: Initializer> LsDriver<DapMessage, Args>
where Args::S: 'static,

Source

pub fn start( &mut self, inbox: TConnectionRx<DapMessage>, is_replay: bool, ) -> Result<()>

Starts the debug adaptor on the given connection.

If is_replay is true, the server will wait for all pending requests to finish before exiting. This is useful for testing the language server.

See transport::MirrorArgs for information about the record-replay feature.

Source

pub fn start_(&mut self, inbox: TConnectionRx<DapMessage>) -> Result<()>

Starts the debug adaptor on the given connection.

Source§

impl<Args: Initializer> LsDriver<LspMessage, Args>
where Args::S: 'static,

Source

pub fn start( &mut self, inbox: TConnectionRx<LspMessage>, is_replay: bool, ) -> Result<()>

Starts the language server on the given connection.

If is_replay is true, the server will wait for all pending requests to finish before exiting. This is useful for testing the language server.

See transport::MirrorArgs for information about the record-replay feature.

Source

pub fn start_(&mut self, inbox: TConnectionRx<LspMessage>) -> Result<()>

Starts the language server on the given connection.

Source§

impl<M, Args: Initializer> LsDriver<M, Args>

Source

pub fn state(&self) -> Option<&Args::S>

Gets the state of the language server.

Source

pub fn state_mut(&mut self) -> Option<&mut Args::S>

Gets the mutable state of the language server.

Source

pub fn ready(&mut self, params: Args::I) -> AnySchedulableResponse

Makes the language server ready.

Source

pub fn get_resources( &mut self, req_id: RequestId, args: Vec<JsonValue>, ) -> ScheduledResult

Get static resources with help of tinymist service, for example, a static help pages for some typst function.

Auto Trait Implementations§

§

impl<M, Args> Freeze for LsDriver<M, Args>
where <Args as Initializer>::S: Freeze,

§

impl<M, Args> !RefUnwindSafe for LsDriver<M, Args>

§

impl<M, Args> !Send for LsDriver<M, Args>

§

impl<M, Args> !Sync for LsDriver<M, Args>

§

impl<M, Args> Unpin for LsDriver<M, Args>
where <Args as Initializer>::S: Unpin, M: Unpin,

§

impl<M, Args> !UnwindSafe for LsDriver<M, Args>

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<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> 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, 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.
§

impl<T> ErasedDestructor for T
where T: 'static,