pub struct LspManager { /* private fields */ }Expand description
Multi-server LSP manager.
Holds zero or more LspServerConfigs plus the lazily-spawned
LspClient for each. Thread-safe via parking_lot::RwLock.
Implementations§
Source§impl LspManager
impl LspManager
Sourcepub const DEFAULT_DRAIN_TIMEOUT: Duration
pub const DEFAULT_DRAIN_TIMEOUT: Duration
Diagnostic drain timeout for drain_diagnostics. 50ms is
short enough to not stall the agent loop but long enough to
catch a fresh publishDiagnostics after a write.
Sourcepub fn new(servers: Vec<LspServerConfig>, workspace_root: PathBuf) -> Self
pub fn new(servers: Vec<LspServerConfig>, workspace_root: PathBuf) -> Self
Construct with the given server table and workspace root.
Sourcepub fn with_defaults(workspace_root: PathBuf) -> Self
pub fn with_defaults(workspace_root: PathBuf) -> Self
Construct using default_servers() for the configured
workspace root.
Sourcepub fn server_count(&self) -> usize
pub fn server_count(&self) -> usize
Number of configured (static) servers — does not reflect lazy-spawned live clients.
Sourcepub fn handles_path(&self, path: &Path) -> bool
pub fn handles_path(&self, path: &Path) -> bool
Whether any configured server handles this file extension.
Sourcepub fn workspace_root(&self) -> &Path
pub fn workspace_root(&self) -> &Path
Borrow the workspace root.
Sourcepub async fn client_for_path(
&self,
path: &Path,
) -> Result<Option<Arc<LspClient>>, LspError>
pub async fn client_for_path( &self, path: &Path, ) -> Result<Option<Arc<LspClient>>, LspError>
Get-or-spawn the live client for path’s owning server.
Returns None when no server is configured for path’s
extension. Returns Err when the server fails to spawn or
initialize.
Sourcepub fn running_client(&self, name: &str) -> Option<Arc<LspClient>>
pub fn running_client(&self, name: &str) -> Option<Arc<LspClient>>
Look up the client by server name (must already be running).
Sourcepub async fn shutdown_all(&self)
pub async fn shutdown_all(&self)
Best-effort shutdown of every live client.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LspManager
impl !UnwindSafe for LspManager
impl Freeze for LspManager
impl Send for LspManager
impl Sync for LspManager
impl Unpin for LspManager
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
self file descriptor. Read moreSource§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