Expand description
Autoread — external-change detection + refresh for file-backed
Document buffers (vim’s autoread).
See docs/dev/architecture/autoread.md for the design and
docs/dev/operations/slice-plans/autoread.md (AR.*) for sequencing.
AR.0 (this file, first slice) lands the on-disk fingerprint only —
the seam every later slice gates on. No watcher yet. The fingerprint is
stamped when a buffer loads and after the editor’s own :w; the live
notify watcher (AR.2) compares an incoming filesystem event’s post-read
fingerprint against the stored one to (a) suppress the event its own save
produced and (b) skip no-op touches.
Structs§
- Autoread
Change - A detected external change to a watched file. Emitted by the watcher task,
drained by the host, which maps
pathback to aBufferId. - Autoread
Watcher Handle - Handle held by
Editor. Cheap to own; sends are non-blocking. Drop it (or sendShutdown) to tear the task down — the watcher drops and every OS watch is released. - OnDisk
Fingerprint - The on-disk identity of a file-backed buffer at the moment the editor
last synced with disk — a load, or its own
:w.
Enums§
- Autoread
Change Kind - What kind of external change the watcher detected for a file.
- Autoread
Watcher Command - Editor → watcher-task control commands.
Functions§
- classify_
autoread - Classify a
notifyevent for autoread.Create/Modify⇒Modified;Remove⇒Deleted; access/other ⇒ ignored. The classification is only a hint — the host re-stats on receipt, so a rename mis-labelledModifiedstill resolves correctly (the host finds the file missing and treats it as a delete). - spawn_
autoread_ watcher_ task - Spawn the autoread watcher task on the LSP runtime. Returns the handle
Editorkeeps plus the change receiver the host drains (AR.4).Erronly ifnotifyitself fails to construct the OS watcher.