pub struct LspManager { /* private fields */ }Implementations§
Source§impl LspManager
impl LspManager
pub fn new() -> Self
Sourcepub fn override_binary(&mut self, kind: ServerKind, binary_path: PathBuf)
pub fn override_binary(&mut self, kind: ServerKind, binary_path: PathBuf)
For testing: override the binary for a server kind.
Sourcepub fn ensure_server_for_file(&mut self, file_path: &Path) -> Vec<ServerKey>
pub fn ensure_server_for_file(&mut self, file_path: &Path) -> Vec<ServerKey>
Ensure a server is running for the given file. Spawns if needed. Returns the active server keys for the file, or an empty vec if none match.
Sourcepub fn ensure_file_open(
&mut self,
file_path: &Path,
) -> Result<Vec<ServerKey>, LspError>
pub fn ensure_file_open( &mut self, file_path: &Path, ) -> Result<Vec<ServerKey>, LspError>
Ensure that servers are running for the file and that the document is open in each server’s DocumentStore. Reads file content from disk if not already open. Returns the server keys for the file.
Sourcepub fn notify_file_changed(
&mut self,
file_path: &Path,
content: &str,
) -> Result<(), LspError>
pub fn notify_file_changed( &mut self, file_path: &Path, content: &str, ) -> Result<(), LspError>
Notify relevant LSP servers that a file has been written/changed. This is the main hook called after every file write in AFT.
If the file’s server isn’t running yet, starts it (lazy spawn). If the file isn’t open in LSP yet, sends didOpen. Otherwise sends didChange.
Sourcepub fn notify_file_closed(&mut self, file_path: &Path) -> Result<(), LspError>
pub fn notify_file_closed(&mut self, file_path: &Path) -> Result<(), LspError>
Close a document in all servers that have it open.
Sourcepub fn client_for_file(&self, file_path: &Path) -> Option<&LspClient>
pub fn client_for_file(&self, file_path: &Path) -> Option<&LspClient>
Get an active client for a file path, if one exists.
Sourcepub fn client_for_file_mut(
&mut self,
file_path: &Path,
) -> Option<&mut LspClient>
pub fn client_for_file_mut( &mut self, file_path: &Path, ) -> Option<&mut LspClient>
Get a mutable active client for a file path, if one exists.
Sourcepub fn active_client_count(&self) -> usize
pub fn active_client_count(&self) -> usize
Number of tracked server clients.
Sourcepub fn drain_events(&mut self) -> Vec<LspEvent>
pub fn drain_events(&mut self) -> Vec<LspEvent>
Drain all pending LSP events. Call from the main loop.
Sourcepub fn wait_for_diagnostics(
&mut self,
file_path: &Path,
timeout: Duration,
) -> Vec<StoredDiagnostic>
pub fn wait_for_diagnostics( &mut self, file_path: &Path, timeout: Duration, ) -> Vec<StoredDiagnostic>
Wait briefly for diagnostics to arrive for a specific file after a change.
This mirrors the existing lsp_diagnostics command behavior: sleep for a
short interval, drain queued LSP notifications, then read diagnostics from
the store using the canonicalized file path.
Sourcepub fn shutdown_all(&mut self)
pub fn shutdown_all(&mut self)
Shutdown all servers gracefully.
Sourcepub fn has_active_servers(&self) -> bool
pub fn has_active_servers(&self) -> bool
Check if any server is active.
pub fn get_diagnostics_for_file(&self, file: &Path) -> Vec<&StoredDiagnostic>
pub fn get_diagnostics_for_directory( &self, dir: &Path, ) -> Vec<&StoredDiagnostic>
pub fn get_all_diagnostics(&self) -> Vec<&StoredDiagnostic>
Trait Implementations§
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> 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