pub struct LspClient { /* private fields */ }Expand description
Client for connecting to a running aether-lspd daemon over a Unix domain socket. Requests from one client run concurrently, so a slow diagnostics query never holds up a hover.
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– Jump to a symbol’s definition.find_references– Find all references to a symbol.hover– Get hover information (type signature, docs).document_symbol– List all symbols in a document.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 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 document_symbol( &self, uri: Uri, ) -> ClientResult<DocumentSymbolResponse>
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<()>
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether the daemon connection’s reader task is still running.