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,
impl<Args: Initializer> LsDriver<DapMessage, Args>where
Args::S: 'static,
Sourcepub fn start(
&mut self,
inbox: TConnectionRx<DapMessage>,
is_replay: bool,
) -> Result<()>
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.
Sourcepub fn start_(&mut self, inbox: TConnectionRx<DapMessage>) -> Result<()>
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,
impl<Args: Initializer> LsDriver<LspMessage, Args>where
Args::S: 'static,
Sourcepub fn start(
&mut self,
inbox: TConnectionRx<LspMessage>,
is_replay: bool,
) -> Result<()>
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.
Sourcepub fn start_(&mut self, inbox: TConnectionRx<LspMessage>) -> Result<()>
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>
impl<M, Args: Initializer> LsDriver<M, Args>
Sourcepub fn state_mut(&mut self) -> Option<&mut Args::S>
pub fn state_mut(&mut self) -> Option<&mut Args::S>
Gets the mutable state of the language server.
Sourcepub fn ready(&mut self, params: Args::I) -> AnySchedulableResponse
pub fn ready(&mut self, params: Args::I) -> AnySchedulableResponse
Makes the language server ready.
Sourcepub fn get_resources(
&mut self,
req_id: RequestId,
args: Vec<JsonValue>,
) -> ScheduledResult
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.