pub struct LspConnection { /* private fields */ }Expand description
Manages connection to an external LSP server
Implementations§
Source§impl LspConnection
impl LspConnection
Sourcepub fn handler(&self) -> &JsonRpcHandler
pub fn handler(&self) -> &JsonRpcHandler
Get the JSON-RPC handler
Sourcepub async fn create_tracked_request(
&self,
method: impl Into<String>,
params: Option<Value>,
timeout: Duration,
) -> Result<(JsonRpcRequest, Receiver<Result<Value>>)>
pub async fn create_tracked_request( &self, method: impl Into<String>, params: Option<Value>, timeout: Duration, ) -> Result<(JsonRpcRequest, Receiver<Result<Value>>)>
Create a new request and track it
Sourcepub async fn handle_response(&self, response: JsonRpcResponse) -> Result<()>
pub async fn handle_response(&self, response: JsonRpcResponse) -> Result<()>
Handle a response and correlate it to a pending request
Sourcepub async fn pending_request_count(&self) -> usize
pub async fn pending_request_count(&self) -> usize
Get pending request count
Sourcepub async fn cleanup_timed_out_requests(&self) -> Vec<RequestId> ⓘ
pub async fn cleanup_timed_out_requests(&self) -> Vec<RequestId> ⓘ
Check for timed out requests and clean them up
Sourcepub async fn clear_pending_requests(&self)
pub async fn clear_pending_requests(&self)
Clear all pending requests
Sourcepub async fn get_pending_request_ids(&self) -> Vec<RequestId> ⓘ
pub async fn get_pending_request_ids(&self) -> Vec<RequestId> ⓘ
Get list of pending request IDs
Sourcepub async fn handle_notification(
&self,
notification: JsonRpcNotification,
) -> Result<()>
pub async fn handle_notification( &self, notification: JsonRpcNotification, ) -> Result<()>
Handle a notification from the server
Sourcepub fn subscribe_notifications(&self) -> Receiver<(String, Option<Value>)>
pub fn subscribe_notifications(&self) -> Receiver<(String, Option<Value>)>
Subscribe to notifications
Sourcepub async fn handle_publish_diagnostics(
&self,
params: Option<Value>,
) -> Result<()>
pub async fn handle_publish_diagnostics( &self, params: Option<Value>, ) -> Result<()>
Handle textDocument/publishDiagnostics notification
Sourcepub async fn handle_log_message(&self, params: Option<Value>) -> Result<()>
pub async fn handle_log_message(&self, params: Option<Value>) -> Result<()>
Handle window/logMessage notification
Sourcepub async fn handle_show_message(&self, params: Option<Value>) -> Result<()>
pub async fn handle_show_message(&self, params: Option<Value>) -> Result<()>
Handle window/showMessage notification
Sourcepub async fn send_did_open(
&self,
uri: String,
language_id: String,
version: i32,
text: String,
) -> Result<()>
pub async fn send_did_open( &self, uri: String, language_id: String, version: i32, text: String, ) -> Result<()>
Send textDocument/didOpen notification
Sourcepub async fn send_did_change(
&self,
uri: String,
version: i32,
content_changes: Vec<Value>,
) -> Result<()>
pub async fn send_did_change( &self, uri: String, version: i32, content_changes: Vec<Value>, ) -> Result<()>
Send textDocument/didChange notification
Sourcepub async fn send_did_close(&self, uri: String) -> Result<()>
pub async fn send_did_close(&self, uri: String) -> Result<()>
Send textDocument/didClose notification
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LspConnection
impl !RefUnwindSafe for LspConnection
impl Send for LspConnection
impl Sync for LspConnection
impl Unpin for LspConnection
impl !UnwindSafe for LspConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more