pub struct FileTracker { /* private fields */ }Expand description
Tracks which files are open in the LSP server.
LSP requires textDocument/didOpen before any queries on a file.
This tracker ensures idempotent opens and bulk close on shutdown.
Implementations§
Source§impl FileTracker
impl FileTracker
Sourcepub async fn ensure_open(
&mut self,
path: &Path,
transport: &mut LspTransport,
) -> Result<()>
pub async fn ensure_open( &mut self, path: &Path, transport: &mut LspTransport, ) -> Result<()>
Ensure a file is open in the LSP server. If already open, this is a no-op.
§Errors
Returns an error if the file can’t be read or the notification fails.
Sourcepub async fn open_with_content(
&mut self,
path: &Path,
uri: &str,
content: &str,
transport: &mut LspTransport,
) -> Result<()>
pub async fn open_with_content( &mut self, path: &Path, uri: &str, content: &str, transport: &mut LspTransport, ) -> Result<()>
Open a file with pre-read content (avoids duplicate disk I/O during indexing).
§Errors
Returns an error if the notification fails.
Sourcepub async fn reopen(
&mut self,
path: &Path,
transport: &mut LspTransport,
) -> Result<()>
pub async fn reopen( &mut self, path: &Path, transport: &mut LspTransport, ) -> Result<()>
Force-reopen a file, sending fresh content to the LSP.
Unlike ensure_open, this always sends didClose (if already open) followed by
didOpen with the current on-disk content. Use this after a file has been edited
so the language server analyses the new version.
§Errors
Returns an error if the file can’t be read or the notification fails.
Sourcepub async fn close_all(&mut self, transport: &mut LspTransport) -> Result<()>
pub async fn close_all(&mut self, transport: &mut LspTransport) -> Result<()>
Sourcepub fn open_count(&self) -> usize
pub fn open_count(&self) -> usize
Number of currently open files.
Auto Trait Implementations§
impl Freeze for FileTracker
impl RefUnwindSafe for FileTracker
impl Send for FileTracker
impl Sync for FileTracker
impl Unpin for FileTracker
impl UnsafeUnpin for FileTracker
impl UnwindSafe for FileTracker
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