LspBridge

Struct LspBridge 

Source
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

Source

pub fn new() -> Self

Create a new LSP Bridge instance.

Source

pub async fn register_server<I: Into<String>>( &mut self, server_id: I, config: LspServerConfig, ) -> Result<ServerId>

Register a new LSP server with the bridge.

§Arguments
  • server_id - Unique identifier for the server
  • config - Configuration for the server
§Returns

The server ID that can be used for subsequent operations.

Source

pub async fn unregister_server(&mut self, server_id: &str) -> Result<()>

Unregister an LSP server from the bridge.

Source

pub async fn start_server(&mut self, server_id: &str) -> Result<()>

Start an LSP server.

Source

pub async fn stop_server(&mut self, server_id: &str) -> Result<()>

Stop an LSP server.

Source

pub async fn restart_server(&mut self, server_id: &str) -> Result<()>

Restart an LSP server.

Source

pub async fn server_state(&self, server_id: &str) -> Result<ServerState>

Get the state of an LSP server.

Source

pub async fn server_capabilities( &self, server_id: &str, ) -> Result<ServerCapabilities>

Get the capabilities of an LSP server.

Source

pub async fn set_active_server(&self, server_id: Option<ServerId>) -> Result<()>

Set the active server for operations that don’t specify a server.

Source

pub async fn active_server(&self) -> Option<ServerId>

Get the active server ID.

Source

pub async fn wait_server_ready(&self, server_id: &str) -> Result<()>

Wait for a server to become ready.

Source

pub async fn open_document( &self, server_id: &str, uri: &str, content: &str, ) -> Result<()>

Open a document in an LSP server.

Source

pub async fn close_document(&self, server_id: &str, uri: &str) -> Result<()>

Close a document in an LSP server.

Source

pub async fn update_document( &self, server_id: &str, uri: &str, content: &str, ) -> Result<()>

Update document content.

Source

pub async fn get_completions( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Vec<CompletionItem>>

Request completions for a document position.

Source

pub async fn get_hover( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Option<Hover>>

Get hover information for a document position.

Source

pub async fn go_to_definition( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Option<Location>>

Go to definition for a document position.

Source

pub async fn find_references( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Vec<Location>>

Find references for a document position.

Source

pub async fn format_document( &self, server_id: &str, uri: &str, ) -> Result<Vec<TextEdit>>

Format a document.

Source

pub fn get_diagnostics( &self, server_id: &str, uri: &str, ) -> Result<Vec<Diagnostic>>

Get diagnostics for a document.

Source

pub async fn request<R: Request>( &self, server_id: &str, params: R::Params, ) -> Result<R::Result>

Send a custom request to a server.

Source

pub async fn notify<N: Notification>( &self, server_id: &str, params: N::Params, ) -> Result<()>
where N::Params: Serialize,

Send a custom notification to a server.

Source

pub fn get_document_state(&self, uri: &str) -> Option<DocumentState>

Get document state.

Source

pub fn list_documents(&self) -> Vec<String>

List all open documents.

Source

pub fn server_count(&self) -> usize

Get the number of registered servers (for testing/debugging).

Source

pub fn has_server(&self, server_id: &str) -> bool

Check if a server is registered (for testing/debugging).

Source

pub fn list_servers(&self) -> Vec<String>

List all registered server IDs (for testing/debugging).

Source

pub async fn get_type_definition( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Option<Location>>

Get type definition for a symbol.

Source

pub async fn get_implementation( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Option<Location>>

Get implementation for a symbol.

Source

pub async fn get_document_highlights( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Vec<DocumentHighlight>>

Get document highlights for a position.

Source

pub async fn get_code_lens( &self, server_id: &str, uri: &str, ) -> Result<Vec<CodeLens>>

Get code lens for a document.

Source

pub async fn resolve_code_lens( &self, server_id: &str, code_lens: CodeLens, ) -> Result<CodeLens>

Resolve a code lens.

Get document links.

Resolve a document link.

Source

pub async fn get_document_colors( &self, server_id: &str, uri: &str, ) -> Result<Vec<ColorInformation>>

Get document colors.

Source

pub async fn get_color_presentations( &self, server_id: &str, uri: &str, color: Color, range: Range, ) -> Result<Vec<ColorPresentation>>

Get color presentations.

Source

pub async fn format_document_range( &self, server_id: &str, uri: &str, range: Range, ) -> Result<Vec<TextEdit>>

Format document range.

Source

pub async fn format_document_on_type( &self, server_id: &str, uri: &str, position: Position, ch: String, ) -> Result<Vec<TextEdit>>

Format document on type.

Source

pub async fn get_folding_ranges( &self, server_id: &str, uri: &str, ) -> Result<Vec<FoldingRange>>

Get folding ranges.

Source

pub async fn get_selection_ranges( &self, server_id: &str, uri: &str, positions: Vec<Position>, ) -> Result<Vec<SelectionRange>>

Get selection ranges.

Source

pub async fn execute_command( &self, server_id: &str, command: String, arguments: Option<Vec<Value>>, ) -> Result<Option<Value>>

Execute a command.

Source

pub async fn prepare_call_hierarchy( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Vec<CallHierarchyItem>>

Prepare call hierarchy.

Source

pub async fn get_incoming_calls( &self, server_id: &str, item: CallHierarchyItem, ) -> Result<Vec<CallHierarchyIncomingCall>>

Get incoming calls.

Source

pub async fn get_outgoing_calls( &self, server_id: &str, item: CallHierarchyItem, ) -> Result<Vec<CallHierarchyOutgoingCall>>

Get outgoing calls.

Source

pub async fn get_semantic_tokens_full( &self, server_id: &str, uri: &str, ) -> Result<Option<SemanticTokens>>

Get semantic tokens (full).

Source

pub async fn get_semantic_tokens_delta( &self, server_id: &str, uri: &str, previous_result_id: String, ) -> Result<Option<SemanticTokensResult>>

Get semantic tokens (delta).

Source

pub async fn get_semantic_tokens_range( &self, server_id: &str, uri: &str, range: Range, ) -> Result<Option<SemanticTokens>>

Get semantic tokens (range).

Source

pub async fn get_inlay_hints( &self, server_id: &str, uri: &str, range: Range, ) -> Result<Vec<InlayHint>>

Get inlay hints.

Source

pub async fn resolve_inlay_hint( &self, server_id: &str, hint: InlayHint, ) -> Result<InlayHint>

Resolve inlay hint.

Source

pub async fn get_inline_values( &self, server_id: &str, uri: &str, range: Range, context: InlineValueContext, ) -> Result<Vec<InlineValue>>

Get inline values.

Source

pub async fn get_monikers( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Vec<Moniker>>

Get monikers.

Source

pub async fn resolve_completion_item( &self, server_id: &str, item: CompletionItem, ) -> Result<CompletionItem>

Resolve completion item.

Source

pub async fn shutdown(&mut self) -> Result<()>

Shutdown all servers and cleanup.

Source

pub async fn get_signature_help( &self, server_id: &str, uri: &str, position: Position, ) -> Result<Option<SignatureHelp>>

Get signature help at a position.

Source

pub async fn get_document_symbols( &self, server_id: &str, uri: &str, ) -> Result<Vec<DocumentSymbol>>

Get document symbols.

Source

pub async fn get_workspace_symbols( &self, server_id: &str, query: &str, ) -> Result<Vec<SymbolInformation>>

Get workspace symbols.

Source

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.

Source

pub async fn rename_symbol( &self, server_id: &str, uri: &str, position: Position, new_name: &str, ) -> Result<Option<WorkspaceEdit>>

Rename a symbol.

Source

pub fn apply_text_edits( &self, content: &str, edits: &[TextEdit], ) -> Result<String>

Apply text edits to content and return the result.

Trait Implementations§

Source§

impl Default for LspBridge

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl LspServerManager for LspBridge

Source§

fn start_server<'life0, 'life1, 'async_trait>( &'life0 mut self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Start a server.
Source§

fn stop_server<'life0, 'life1, 'async_trait>( &'life0 mut self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stop a server.
Source§

fn restart_server<'life0, 'life1, 'async_trait>( &'life0 mut self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restart a server.
Source§

fn server_state<'life0, 'life1, 'async_trait>( &'life0 self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ServerState>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get server state.
Source§

fn server_capabilities<'life0, 'life1, 'async_trait>( &'life0 self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ServerCapabilities>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get server capabilities.
Source§

fn server_request<'life0, 'life1, 'async_trait>( &'life0 self, server_id: &'life1 str, method: String, params: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send request to server.
Source§

fn server_notify<'life0, 'life1, 'async_trait>( &'life0 self, server_id: &'life1 str, method: String, params: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send notification to server.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,