pub struct LspManager { /* private fields */ }Expand description
Manages lifecycle of multiple language server clients.
Lazily starts LSP servers on-demand based on file extension. Each extension maps to at most one running server instance. Servers are started when first needed and remain running until explicitly shut down or the manager is dropped.
Implementations§
Source§impl LspManager
impl LspManager
Sourcepub fn new(
project_root: PathBuf,
registry: LspServerRegistry,
enabled: bool,
diagnostics_settle_delay_ms: u64,
) -> Self
pub fn new( project_root: PathBuf, registry: LspServerRegistry, enabled: bool, diagnostics_settle_delay_ms: u64, ) -> Self
Create a new LSP manager without an event channel. Status changes are silently dropped — appropriate for tests and headless mode where no UI consumes them.
Sourcepub fn with_event_channel(
project_root: PathBuf,
registry: LspServerRegistry,
enabled: bool,
diagnostics_settle_delay_ms: u64,
) -> (Self, UnboundedReceiver<LspConnectEvent>)
pub fn with_event_channel( project_root: PathBuf, registry: LspServerRegistry, enabled: bool, diagnostics_settle_delay_ms: u64, ) -> (Self, UnboundedReceiver<LspConnectEvent>)
Create a new LSP manager paired with a receiver for connection
status events. The TUI event loop consumes the receiver and
renders Started / Failed events as scrollback lines next to
the existing MCP rendering.
Sourcepub fn diagnostics_settle_delay_ms(&self) -> u64
pub fn diagnostics_settle_delay_ms(&self) -> u64
Get the configured diagnostics settle delay in milliseconds.
Sourcepub async fn ensure_server(&self, file_path: &Path) -> Result<bool>
pub async fn ensure_server(&self, file_path: &Path) -> Result<bool>
Ensure a language server is running for the given file’s extension.
Returns Ok(true) if a server is (now) running, Ok(false) if no
server is configured or the command is not installed.
Sourcepub async fn diagnostics(&self, path: &Path) -> Vec<Diagnostic>
pub async fn diagnostics(&self, path: &Path) -> Vec<Diagnostic>
Get diagnostics for a specific file. Returns an empty vector if no server is running for that file type.
Sourcepub async fn all_diagnostics(&self) -> Vec<Diagnostic>
pub async fn all_diagnostics(&self) -> Vec<Diagnostic>
Get all diagnostics from all running servers. Aggregates diagnostics across all file types with active servers.
Sourcepub async fn notify_file_changed(
&self,
path: &Path,
content: &str,
) -> Result<bool>
pub async fn notify_file_changed( &self, path: &Path, content: &str, ) -> Result<bool>
Ensure the appropriate server is running, then notify it that a file changed.
This triggers the server to re-analyze the file and publish updated diagnostics.
Returns Ok(true) if a server received the notification, Ok(false) otherwise.
Sourcepub async fn active_servers(&self) -> Vec<String>
pub async fn active_servers(&self) -> Vec<String>
List the file extensions that have active servers. Useful for debugging and status display.
Auto Trait Implementations§
impl Freeze for LspManager
impl !RefUnwindSafe for LspManager
impl Send for LspManager
impl Sync for LspManager
impl Unpin for LspManager
impl UnsafeUnpin for LspManager
impl !UnwindSafe for LspManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more