pub struct LspClient { /* private fields */ }Expand description
Client for connecting to a running LspDaemon over a Unix domain socket.
LspClient is the primary entry point for consumers of this crate. Call connect with a workspace root and language – the client will auto-spawn a daemon process if one isn’t already running, then send an Initialize handshake.
§Connection lifecycle
connect(workspace_root, language)
→ auto-spawn daemon if needed
→ Initialize handshake
→ ready for LSP requests
→ disconnect()§LSP requests
All requests are forwarded to the underlying language server through the daemon. Each method accepts the same parameters as the corresponding LSP protocol method:
goto_definition/goto_implementation– Jump to a symbol’s definition or implementation.find_references– Find all references to a symbol.hover– Get hover information (type signature, docs).workspace_symbol– Search for symbols across the workspace.document_symbol– List all symbols in a document.prepare_call_hierarchy,incoming_calls,outgoing_calls– Navigate the call graph.rename– Rename a symbol across the workspace.
§Diagnostics
get_diagnostics– Retrieve cached diagnostics for a file (or all files ifuriisNone).queue_diagnostic_refresh– Ask the daemon to re-check a file and update its diagnostics cache.
§Generic requests
call sends an arbitrary LSP method with typed parameters and response. Use this for LSP methods that don’t have a dedicated wrapper.
§Example
use aether_lspd::{LspClient, LanguageId, path_to_uri};
use std::path::Path;
let client = LspClient::connect(
Path::new("/home/user/my-project"),
LanguageId::Rust,
).await?;
let uri = path_to_uri(Path::new("/home/user/my-project/src/main.rs")).unwrap();
let hover = client.hover(uri, 10, 5).await?;
client.disconnect().await?;Implementations§
Source§impl LspClient
impl LspClient
pub async fn connect( workspace_root: &Path, language: LanguageId, ) -> ClientResult<Self>
pub async fn goto_definition( &self, uri: Uri, line: u32, character: u32, ) -> ClientResult<GotoDefinitionResponse>
pub async fn goto_implementation( &self, uri: Uri, line: u32, character: u32, ) -> ClientResult<GotoDefinitionResponse>
pub async fn find_references( &self, uri: Uri, line: u32, character: u32, include_declaration: bool, ) -> ClientResult<Vec<Location>>
pub async fn hover( &self, uri: Uri, line: u32, character: u32, ) -> ClientResult<Option<Hover>>
pub async fn workspace_symbol( &self, query: String, ) -> ClientResult<Vec<SymbolInformation>>
pub async fn document_symbol( &self, uri: Uri, ) -> ClientResult<DocumentSymbolResponse>
pub async fn prepare_call_hierarchy( &self, uri: Uri, line: u32, character: u32, ) -> ClientResult<Vec<CallHierarchyItem>>
pub async fn incoming_calls( &self, item: CallHierarchyItem, ) -> ClientResult<Vec<CallHierarchyIncomingCall>>
pub async fn outgoing_calls( &self, item: CallHierarchyItem, ) -> ClientResult<Vec<CallHierarchyOutgoingCall>>
pub async fn rename( &self, uri: Uri, line: u32, character: u32, new_name: String, ) -> ClientResult<Option<WorkspaceEdit>>
pub async fn get_diagnostics( &self, uri: Option<Uri>, ) -> ClientResult<Vec<PublishDiagnosticsParams>>
pub async fn queue_diagnostic_refresh(&self, uri: Uri) -> ClientResult<()>
pub async fn disconnect(self) -> ClientResult<()>
pub async fn call<P: Serialize, R: DeserializeOwned>( &self, method: &str, params: &P, default: impl FnOnce() -> R, ) -> ClientResult<R>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LspClient
impl !RefUnwindSafe for LspClient
impl Send for LspClient
impl Sync for LspClient
impl Unpin for LspClient
impl UnsafeUnpin for LspClient
impl !UnwindSafe for LspClient
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