pub struct TextDocument { /* private fields */ }Expand description
In-memory representation of an open LSP text document.
Implementations§
Source§impl TextDocument
impl TextDocument
Sourcepub fn new(contents: String, version: i32) -> Self
pub fn new(contents: String, version: i32) -> Self
Create a document with initial contents and version.
Sourcepub fn with_language_id(self, language_id: &str) -> Self
pub fn with_language_id(self, language_id: &str) -> Self
Return a copy with the LSP language identifier attached.
Sourcepub fn language_id(&self) -> Option<LanguageId>
pub fn language_id(&self) -> Option<LanguageId>
Return the parsed language identifier, if one was supplied by the client.
Sourcepub fn apply_changes(
&mut self,
changes: Vec<TextDocumentContentChangeEvent>,
new_version: i32,
encoding: PositionEncoding,
)
pub fn apply_changes( &mut self, changes: Vec<TextDocumentContentChangeEvent>, new_version: i32, encoding: PositionEncoding, )
Apply LSP content changes and update the document version.
Sourcepub fn update_version(&mut self, new_version: i32)
pub fn update_version(&mut self, new_version: i32)
Update the document version without changing contents.
Trait Implementations§
Source§impl Clone for TextDocument
impl Clone for TextDocument
Source§fn clone(&self) -> TextDocument
fn clone(&self) -> TextDocument
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TextDocument
impl RefUnwindSafe for TextDocument
impl Send for TextDocument
impl Sync for TextDocument
impl Unpin for TextDocument
impl UnsafeUnpin for TextDocument
impl UnwindSafe for TextDocument
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