pub struct DocumentState {
pub uri: Uri,
pub language_id: String,
pub version: i32,
pub content: String,
pub disk: Option<DiskSync>,
pub synced: HashMap<ServerId, i32>,
}Expand description
State of a single document.
Fields§
§uri: UriDocument URI.
language_id: StringLanguage identifier.
version: i32Document version (monotonically increasing).
content: StringDocument content.
disk: Option<DiskSync>Filesystem snapshot as of the last time content was read from disk.
None means the content’s on-disk provenance is unknown (it came from
an in-memory open/update call, not a verified disk read), so
ensure_open must always re-verify by content compare rather than
trusting a stat match.
DiskSync’s hand-written PartialEq excludes content_checked_at
(see that field’s doc comment), and that exclusion propagates here:
two DocumentStates can compare equal via this struct’s derived
PartialEq/Eq despite having been disk-verified at different
instants. This is intentional – content_checked_at is a debounce
timer, not part of a document’s logical state.
synced: HashMap<ServerId, i32>Last document version pushed to each server via didOpen/didChange.
A single document can be synced to multiple servers (e.g. hover
routed to one server, diagnostics to another for the same language),
each needing its own didOpen/didChange history – a server absent
from this map has never seen the document and must receive
didOpen, not didChange, on its next ensure_open call.
Trait Implementations§
Source§impl Clone for DocumentState
impl Clone for DocumentState
Source§fn clone(&self) -> DocumentState
fn clone(&self) -> DocumentState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more