Skip to main content

LspManager

Struct LspManager 

Source
pub struct LspManager { /* private fields */ }

Implementations§

Source§

impl LspManager

Source

pub fn new() -> Self

Source

pub fn override_binary(&mut self, kind: ServerKind, binary_path: PathBuf)

For testing: override the binary for a server kind.

Source

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.

Source

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.

Source

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.

Source

pub fn notify_file_closed(&mut self, file_path: &Path) -> Result<(), LspError>

Close a document in all servers that have it open.

Source

pub fn client_for_file(&self, file_path: &Path) -> Option<&LspClient>

Get an active client for a file path, if one exists.

Source

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.

Source

pub fn active_client_count(&self) -> usize

Number of tracked server clients.

Source

pub fn drain_events(&mut self) -> Vec<LspEvent>

Drain all pending LSP events. Call from the main loop.

Source

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.

Source

pub fn shutdown_all(&mut self)

Shutdown all servers gracefully.

Source

pub fn has_active_servers(&self) -> bool

Check if any server is active.

Source

pub fn get_diagnostics_for_file(&self, file: &Path) -> Vec<&StoredDiagnostic>

Source

pub fn get_diagnostics_for_directory( &self, dir: &Path, ) -> Vec<&StoredDiagnostic>

Source

pub fn get_all_diagnostics(&self) -> Vec<&StoredDiagnostic>

Trait Implementations§

Source§

impl Default for LspManager

Source§

fn default() -> Self

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

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, 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.