Skip to main content

ProjectDiffService

Struct ProjectDiffService 

Source
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

Source

pub fn new() -> Self

Source

pub fn set_state(&self, view: BufferId, state: ProjectDiffState)

Source

pub fn state(&self, view: BufferId) -> Option<ProjectDiffState>

Source

pub fn index_document(&self, document: DocumentId, view: BufferId)

Source

pub fn forget_by_document_id(&self, document: DocumentId) -> bool

Cleanup entry point for the DocumentClosed subscriber.

Source

pub fn forget(&self, view: BufferId)

Source

pub fn tracked_views(&self) -> usize

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Hand-written because ProjectDiffStyling holds provider handles that are not Debug, and the useful thing to print is how many views are tracked rather than their contents.

Source§

impl Default for ProjectDiffService

Source§

fn default() -> ProjectDiffService

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more