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, Vec<Value>) -> SchedulableResponse<Value>>>,
pub notifications: HashMap<&'static str, Box<dyn Fn(&mut Args::S, Value) -> LspResult<()>>>,
pub requests: HashMap<&'static str, Box<dyn Fn(&mut Args::S, Value) -> SchedulableResponse<Value>>>,
pub resources: HashMap<Arc<Path>, Box<dyn Fn(&mut Args::S, Vec<Value>) -> SchedulableResponse<Value>>>,
/* private fields */
}Expand description
The language server driver.
Fields§
§client: LspClientThe 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, Vec<Value>) -> SchedulableResponse<Value>>>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, Value) -> SchedulableResponse<Value>>>Requests for dispatching.
resources: HashMap<Arc<Path>, Box<dyn Fn(&mut Args::S, Vec<Value>) -> SchedulableResponse<Value>>>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.
Sourcepub fn on_lsp_request(
&mut self,
method: &str,
params: JsonValue,
) -> ScheduleResult
pub fn on_lsp_request( &mut self, method: &str, params: JsonValue, ) -> ScheduleResult
Registers and handles a request. This should only be called once per incoming request.
Sourcepub fn on_notification(
&mut self,
method: &str,
params: JsonValue,
) -> LspResult<()>
pub fn on_notification( &mut self, method: &str, params: JsonValue, ) -> LspResult<()>
Handles an incoming notification.
Sourcepub fn on_lsp_response(&mut self, resp: Response)
pub fn on_lsp_response(&mut self, resp: Response)
Handles an incoming response.
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, args: Vec<JsonValue>) -> ScheduleResult
pub fn get_resources(&mut self, args: Vec<JsonValue>) -> ScheduleResult
Get static resources with help of tinymist service, for example, a static help pages for some typst function.