pub struct ProjectDiffService { /* private fields */ }Expand description
Per-view state keyed by the view’s BufferId, plus a
DocumentId → BufferId index for cleanup.
The second map is not redundant: Event::DocumentClosed carries a
DocumentId and the two ids are NOT interchangeable — the
multibuffer registry keeps a separate remove_by_document_id for
the same reason.
Implementations§
Source§impl ProjectDiffService
impl ProjectDiffService
pub fn new() -> Self
pub fn set_state(&self, view: BufferId, state: ProjectDiffState)
pub fn state(&self, view: BufferId) -> Option<ProjectDiffState>
pub fn index_document(&self, document: DocumentId, view: BufferId)
Sourcepub fn forget_by_document_id(&self, document: DocumentId) -> bool
pub fn forget_by_document_id(&self, document: DocumentId) -> bool
Cleanup entry point for the DocumentClosed subscriber.
pub fn forget(&self, view: BufferId)
pub fn tracked_views(&self) -> usize
Sourcepub fn begin_styling(
&self,
view: BufferId,
deletion_rows: Option<Arc<ProjectDiffDeletionRows>>,
highlights: Option<PendingSyntheticHighlightsHandle>,
)
pub fn begin_styling( &self, view: BufferId, deletion_rows: Option<Arc<ProjectDiffDeletionRows>>, highlights: Option<PendingSyntheticHighlightsHandle>, )
Start (or restart) a view’s styling bookkeeping. Called at open
AND at every gr, which is what makes a refresh clear the
“edited” marks: the fresh scan’s classification is computed
against the file as it now is, so nothing about it is stale.
Sourcepub fn record_source_styling(
&self,
view: BufferId,
source: BufferId,
changed: DiffSignMap,
removed: Vec<(u32, Vec<String>)>,
)
pub fn record_source_styling( &self, view: BufferId, source: BufferId, changed: DiffSignMap, removed: Vec<(u32, Vec<String>)>, )
Record one file’s classification as the scan produces it.
Sourcepub fn record_summary(&self, view: BufferId, summary: String)
pub fn record_summary(&self, view: BufferId, summary: String)
Remember what the headerline settled on, so the staleness note can extend it instead of replacing what the view says it is.
Sourcepub fn republish_spans(
&self,
view: BufferId,
handle: &MultibufferDocumentHandle,
) -> bool
pub fn republish_spans( &self, view: BufferId, handle: &MultibufferDocumentHandle, ) -> bool
Republish the composed spans from whatever classifications
survive. Returns false when there is nothing wired to publish
through (a test host with no highlight service) — the view then
renders uncoloured rather than failing.
Sourcepub fn mark_source_edited(
&self,
view: BufferId,
source: BufferId,
) -> Option<String>
pub fn mark_source_edited( &self, view: BufferId, source: BufferId, ) -> Option<String>
The staleness policy. Drop everything this view derived from
source’s content, because the user has edited it.
Returns the headerline summary to show, or None when this
source was already marked (every keystroke after the first) or
the view is not tracked.
Clearing rather than recomputing is the decision PD.7c turns on.
The classification is computed against a baseline in source line
coordinates; an in-excerpt insert does not resize the excerpt
(slide_anchors_for_source only slides excerpts an edit sits
above), so the composed rows keep their indices while the text
beneath them moves — every tint below the edit then describes the
wrong line, and the deletion ghosts anchor a row out. Nothing
announces it. Recomputing the tints would fix them and still
leave the excerpt SET stale (an edit creating a new hunk gets no
excerpt; one edited back to the baseline keeps an excerpt showing
unchanged code) — liveness that looks total and is not. The
honest answer is to show no diff styling for a file we can no
longer describe, say so, and let gr rebuild.
Sourcepub fn is_source_edited(&self, view: BufferId, source: BufferId) -> bool
pub fn is_source_edited(&self, view: BufferId, source: BufferId) -> bool
Whether source has been edited since the last scan of view.
Trait Implementations§
Source§impl Debug for ProjectDiffService
impl Debug for ProjectDiffService
Source§impl Default for ProjectDiffService
impl Default for ProjectDiffService
Source§fn default() -> ProjectDiffService
fn default() -> ProjectDiffService
Auto Trait Implementations§
impl !Freeze for ProjectDiffService
impl RefUnwindSafe for ProjectDiffService
impl Send for ProjectDiffService
impl Sync for ProjectDiffService
impl Unpin for ProjectDiffService
impl UnsafeUnpin for ProjectDiffService
impl UnwindSafe for ProjectDiffService
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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