pub struct Vfs { /* private fields */ }Expand description
Concurrent open-document store.
Implementations§
Source§impl Vfs
impl Vfs
Sourcepub fn new(encoding: PositionEncoding) -> Self
pub fn new(encoding: PositionEncoding) -> Self
New empty VFS using the given position encoding.
Sourcepub fn open(&self, uri: DocumentUri, text: &str, version: DocumentVersion)
pub fn open(&self, uri: DocumentUri, text: &str, version: DocumentVersion)
Insert (or replace) a document. Called from textDocument/didOpen.
Sourcepub fn change(
&self,
uri: &DocumentUri,
edits: &[TextEdit],
version: DocumentVersion,
) -> Result<(), VfsError>
pub fn change( &self, uri: &DocumentUri, edits: &[TextEdit], version: DocumentVersion, ) -> Result<(), VfsError>
Apply incremental edits. Called from textDocument/didChange.
§Errors
Returns VfsError::NotFound if the document is unknown,
VfsError::StaleVersion if version is not strictly greater than
the stored version, or VfsError::Edit if an edit’s range is invalid.
Sourcepub fn close(&self, uri: &DocumentUri)
pub fn close(&self, uri: &DocumentUri)
Remove a document. Called from textDocument/didClose.
Sourcepub fn text(&self, uri: &DocumentUri) -> Option<String>
pub fn text(&self, uri: &DocumentUri) -> Option<String>
Read a document’s current text. Returns None if not tracked.
Sourcepub fn version(&self, uri: &DocumentUri) -> Option<DocumentVersion>
pub fn version(&self, uri: &DocumentUri) -> Option<DocumentVersion>
Read a document’s current LSP version. Returns None if not tracked.
Sourcepub fn encoding(&self) -> PositionEncoding
pub fn encoding(&self) -> PositionEncoding
The negotiated position encoding.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Vfs
impl !UnwindSafe for Vfs
impl Freeze for Vfs
impl Send for Vfs
impl Sync for Vfs
impl Unpin for Vfs
impl UnsafeUnpin for Vfs
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
Mutably borrows from an owned value. Read more