pub struct LspBridge { /* private fields */ }Expand description
Main LSP Bridge interface that coordinates all LSP operations.
This is the primary entry point for using the LSP Bridge library. It manages multiple LSP servers, handles document synchronization, and provides a unified interface for LSP operations.
Implementations§
Source§impl LspBridge
impl LspBridge
Sourcepub async fn register_server<I: Into<String>>(
&mut self,
server_id: I,
config: LspServerConfig,
) -> Result<ServerId>
pub async fn register_server<I: Into<String>>( &mut self, server_id: I, config: LspServerConfig, ) -> Result<ServerId>
Sourcepub async fn unregister_server(&mut self, server_id: &str) -> Result<()>
pub async fn unregister_server(&mut self, server_id: &str) -> Result<()>
Unregister an LSP server from the bridge.
Sourcepub async fn start_server(&mut self, server_id: &str) -> Result<()>
pub async fn start_server(&mut self, server_id: &str) -> Result<()>
Start an LSP server.
Sourcepub async fn stop_server(&mut self, server_id: &str) -> Result<()>
pub async fn stop_server(&mut self, server_id: &str) -> Result<()>
Stop an LSP server.
Sourcepub async fn restart_server(&mut self, server_id: &str) -> Result<()>
pub async fn restart_server(&mut self, server_id: &str) -> Result<()>
Restart an LSP server.
Sourcepub async fn server_state(&self, server_id: &str) -> Result<ServerState>
pub async fn server_state(&self, server_id: &str) -> Result<ServerState>
Get the state of an LSP server.
Sourcepub async fn server_capabilities(
&self,
server_id: &str,
) -> Result<ServerCapabilities>
pub async fn server_capabilities( &self, server_id: &str, ) -> Result<ServerCapabilities>
Get the capabilities of an LSP server.
Sourcepub async fn set_active_server(&self, server_id: Option<ServerId>) -> Result<()>
pub async fn set_active_server(&self, server_id: Option<ServerId>) -> Result<()>
Set the active server for operations that don’t specify a server.
Sourcepub async fn active_server(&self) -> Option<ServerId>
pub async fn active_server(&self) -> Option<ServerId>
Get the active server ID.
Sourcepub async fn wait_server_ready(&self, server_id: &str) -> Result<()>
pub async fn wait_server_ready(&self, server_id: &str) -> Result<()>
Wait for a server to become ready.
Sourcepub async fn open_document(
&self,
server_id: &str,
uri: &str,
content: &str,
) -> Result<()>
pub async fn open_document( &self, server_id: &str, uri: &str, content: &str, ) -> Result<()>
Open a document in an LSP server.
Sourcepub async fn close_document(&self, server_id: &str, uri: &str) -> Result<()>
pub async fn close_document(&self, server_id: &str, uri: &str) -> Result<()>
Close a document in an LSP server.
Sourcepub async fn update_document(
&self,
server_id: &str,
uri: &str,
content: &str,
) -> Result<()>
pub async fn update_document( &self, server_id: &str, uri: &str, content: &str, ) -> Result<()>
Update document content.
Sourcepub async fn get_completions(
&self,
server_id: &str,
uri: &str,
position: Position,
) -> Result<Vec<CompletionItem>>
pub async fn get_completions( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Vec<CompletionItem>>
Request completions for a document position.
Sourcepub async fn get_hover(
&self,
server_id: &str,
uri: &str,
position: Position,
) -> Result<Option<Hover>>
pub async fn get_hover( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Option<Hover>>
Get hover information for a document position.
Sourcepub async fn go_to_definition(
&self,
server_id: &str,
uri: &str,
position: Position,
) -> Result<Option<Location>>
pub async fn go_to_definition( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Option<Location>>
Go to definition for a document position.
Sourcepub async fn find_references(
&self,
server_id: &str,
uri: &str,
position: Position,
) -> Result<Vec<Location>>
pub async fn find_references( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Vec<Location>>
Find references for a document position.
Sourcepub async fn format_document(
&self,
server_id: &str,
uri: &str,
) -> Result<Vec<TextEdit>>
pub async fn format_document( &self, server_id: &str, uri: &str, ) -> Result<Vec<TextEdit>>
Format a document.
Sourcepub fn get_diagnostics(
&self,
server_id: &str,
uri: &str,
) -> Result<Vec<Diagnostic>>
pub fn get_diagnostics( &self, server_id: &str, uri: &str, ) -> Result<Vec<Diagnostic>>
Get diagnostics for a document.
Sourcepub async fn request<R: Request>(
&self,
server_id: &str,
params: R::Params,
) -> Result<R::Result>
pub async fn request<R: Request>( &self, server_id: &str, params: R::Params, ) -> Result<R::Result>
Send a custom request to a server.
Sourcepub async fn notify<N: Notification>(
&self,
server_id: &str,
params: N::Params,
) -> Result<()>
pub async fn notify<N: Notification>( &self, server_id: &str, params: N::Params, ) -> Result<()>
Send a custom notification to a server.
Sourcepub fn get_document_state(&self, uri: &str) -> Option<DocumentState>
pub fn get_document_state(&self, uri: &str) -> Option<DocumentState>
Get document state.
Sourcepub fn list_documents(&self) -> Vec<String>
pub fn list_documents(&self) -> Vec<String>
List all open documents.
Sourcepub fn server_count(&self) -> usize
pub fn server_count(&self) -> usize
Get the number of registered servers (for testing/debugging).
Sourcepub fn has_server(&self, server_id: &str) -> bool
pub fn has_server(&self, server_id: &str) -> bool
Check if a server is registered (for testing/debugging).
Sourcepub fn list_servers(&self) -> Vec<String>
pub fn list_servers(&self) -> Vec<String>
List all registered server IDs (for testing/debugging).
Sourcepub async fn get_type_definition(
&self,
server_id: &str,
uri: &str,
position: Position,
) -> Result<Option<Location>>
pub async fn get_type_definition( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Option<Location>>
Get type definition for a symbol.
Sourcepub async fn get_implementation(
&self,
server_id: &str,
uri: &str,
position: Position,
) -> Result<Option<Location>>
pub async fn get_implementation( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Option<Location>>
Get implementation for a symbol.
Sourcepub async fn get_document_highlights(
&self,
server_id: &str,
uri: &str,
position: Position,
) -> Result<Vec<DocumentHighlight>>
pub async fn get_document_highlights( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Vec<DocumentHighlight>>
Get document highlights for a position.
Sourcepub async fn get_code_lens(
&self,
server_id: &str,
uri: &str,
) -> Result<Vec<CodeLens>>
pub async fn get_code_lens( &self, server_id: &str, uri: &str, ) -> Result<Vec<CodeLens>>
Get code lens for a document.
Sourcepub async fn resolve_code_lens(
&self,
server_id: &str,
code_lens: CodeLens,
) -> Result<CodeLens>
pub async fn resolve_code_lens( &self, server_id: &str, code_lens: CodeLens, ) -> Result<CodeLens>
Resolve a code lens.
Sourcepub async fn get_document_links(
&self,
server_id: &str,
uri: &str,
) -> Result<Vec<DocumentLink>>
pub async fn get_document_links( &self, server_id: &str, uri: &str, ) -> Result<Vec<DocumentLink>>
Get document links.
Sourcepub async fn resolve_document_link(
&self,
server_id: &str,
link: DocumentLink,
) -> Result<DocumentLink>
pub async fn resolve_document_link( &self, server_id: &str, link: DocumentLink, ) -> Result<DocumentLink>
Resolve a document link.
Sourcepub async fn get_document_colors(
&self,
server_id: &str,
uri: &str,
) -> Result<Vec<ColorInformation>>
pub async fn get_document_colors( &self, server_id: &str, uri: &str, ) -> Result<Vec<ColorInformation>>
Get document colors.
Sourcepub async fn get_color_presentations(
&self,
server_id: &str,
uri: &str,
color: Color,
range: Range,
) -> Result<Vec<ColorPresentation>>
pub async fn get_color_presentations( &self, server_id: &str, uri: &str, color: Color, range: Range, ) -> Result<Vec<ColorPresentation>>
Get color presentations.
Sourcepub async fn format_document_range(
&self,
server_id: &str,
uri: &str,
range: Range,
) -> Result<Vec<TextEdit>>
pub async fn format_document_range( &self, server_id: &str, uri: &str, range: Range, ) -> Result<Vec<TextEdit>>
Format document range.
Sourcepub async fn format_document_on_type(
&self,
server_id: &str,
uri: &str,
position: Position,
ch: String,
) -> Result<Vec<TextEdit>>
pub async fn format_document_on_type( &self, server_id: &str, uri: &str, position: Position, ch: String, ) -> Result<Vec<TextEdit>>
Format document on type.
Sourcepub async fn get_folding_ranges(
&self,
server_id: &str,
uri: &str,
) -> Result<Vec<FoldingRange>>
pub async fn get_folding_ranges( &self, server_id: &str, uri: &str, ) -> Result<Vec<FoldingRange>>
Get folding ranges.
Sourcepub async fn get_selection_ranges(
&self,
server_id: &str,
uri: &str,
positions: Vec<Position>,
) -> Result<Vec<SelectionRange>>
pub async fn get_selection_ranges( &self, server_id: &str, uri: &str, positions: Vec<Position>, ) -> Result<Vec<SelectionRange>>
Get selection ranges.
Sourcepub async fn execute_command(
&self,
server_id: &str,
command: String,
arguments: Option<Vec<Value>>,
) -> Result<Option<Value>>
pub async fn execute_command( &self, server_id: &str, command: String, arguments: Option<Vec<Value>>, ) -> Result<Option<Value>>
Execute a command.
Sourcepub async fn prepare_call_hierarchy(
&self,
server_id: &str,
uri: &str,
position: Position,
) -> Result<Vec<CallHierarchyItem>>
pub async fn prepare_call_hierarchy( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Vec<CallHierarchyItem>>
Prepare call hierarchy.
Sourcepub async fn get_incoming_calls(
&self,
server_id: &str,
item: CallHierarchyItem,
) -> Result<Vec<CallHierarchyIncomingCall>>
pub async fn get_incoming_calls( &self, server_id: &str, item: CallHierarchyItem, ) -> Result<Vec<CallHierarchyIncomingCall>>
Get incoming calls.
Sourcepub async fn get_outgoing_calls(
&self,
server_id: &str,
item: CallHierarchyItem,
) -> Result<Vec<CallHierarchyOutgoingCall>>
pub async fn get_outgoing_calls( &self, server_id: &str, item: CallHierarchyItem, ) -> Result<Vec<CallHierarchyOutgoingCall>>
Get outgoing calls.
Sourcepub async fn get_semantic_tokens_full(
&self,
server_id: &str,
uri: &str,
) -> Result<Option<SemanticTokens>>
pub async fn get_semantic_tokens_full( &self, server_id: &str, uri: &str, ) -> Result<Option<SemanticTokens>>
Get semantic tokens (full).
Sourcepub async fn get_semantic_tokens_delta(
&self,
server_id: &str,
uri: &str,
previous_result_id: String,
) -> Result<Option<SemanticTokensResult>>
pub async fn get_semantic_tokens_delta( &self, server_id: &str, uri: &str, previous_result_id: String, ) -> Result<Option<SemanticTokensResult>>
Get semantic tokens (delta).
Sourcepub async fn get_semantic_tokens_range(
&self,
server_id: &str,
uri: &str,
range: Range,
) -> Result<Option<SemanticTokens>>
pub async fn get_semantic_tokens_range( &self, server_id: &str, uri: &str, range: Range, ) -> Result<Option<SemanticTokens>>
Get semantic tokens (range).
Sourcepub async fn get_inlay_hints(
&self,
server_id: &str,
uri: &str,
range: Range,
) -> Result<Vec<InlayHint>>
pub async fn get_inlay_hints( &self, server_id: &str, uri: &str, range: Range, ) -> Result<Vec<InlayHint>>
Get inlay hints.
Sourcepub async fn resolve_inlay_hint(
&self,
server_id: &str,
hint: InlayHint,
) -> Result<InlayHint>
pub async fn resolve_inlay_hint( &self, server_id: &str, hint: InlayHint, ) -> Result<InlayHint>
Resolve inlay hint.
Sourcepub async fn get_inline_values(
&self,
server_id: &str,
uri: &str,
range: Range,
context: InlineValueContext,
) -> Result<Vec<InlineValue>>
pub async fn get_inline_values( &self, server_id: &str, uri: &str, range: Range, context: InlineValueContext, ) -> Result<Vec<InlineValue>>
Get inline values.
Sourcepub async fn get_monikers(
&self,
server_id: &str,
uri: &str,
position: Position,
) -> Result<Vec<Moniker>>
pub async fn get_monikers( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Vec<Moniker>>
Get monikers.
Sourcepub async fn resolve_completion_item(
&self,
server_id: &str,
item: CompletionItem,
) -> Result<CompletionItem>
pub async fn resolve_completion_item( &self, server_id: &str, item: CompletionItem, ) -> Result<CompletionItem>
Resolve completion item.
Sourcepub async fn get_signature_help(
&self,
server_id: &str,
uri: &str,
position: Position,
) -> Result<Option<SignatureHelp>>
pub async fn get_signature_help( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Option<SignatureHelp>>
Get signature help at a position.
Sourcepub async fn get_document_symbols(
&self,
server_id: &str,
uri: &str,
) -> Result<Vec<DocumentSymbol>>
pub async fn get_document_symbols( &self, server_id: &str, uri: &str, ) -> Result<Vec<DocumentSymbol>>
Get document symbols.
Sourcepub async fn get_workspace_symbols(
&self,
server_id: &str,
query: &str,
) -> Result<Vec<SymbolInformation>>
pub async fn get_workspace_symbols( &self, server_id: &str, query: &str, ) -> Result<Vec<SymbolInformation>>
Get workspace symbols.
Sourcepub async fn get_code_actions(
&self,
server_id: &str,
uri: &str,
range: Range,
context: CodeActionContext,
) -> Result<Vec<CodeActionOrCommand>>
pub async fn get_code_actions( &self, server_id: &str, uri: &str, range: Range, context: CodeActionContext, ) -> Result<Vec<CodeActionOrCommand>>
Get code actions for a range.
Sourcepub async fn rename_symbol(
&self,
server_id: &str,
uri: &str,
position: Position,
new_name: &str,
) -> Result<Option<WorkspaceEdit>>
pub async fn rename_symbol( &self, server_id: &str, uri: &str, position: Position, new_name: &str, ) -> Result<Option<WorkspaceEdit>>
Rename a symbol.