pub struct EditProposal {
pub id: ProposalId,
pub path: PathBuf,
pub base_version: Option<Version>,
pub base_text: String,
pub proposed_text: String,
pub hunks: Vec<Hunk>,
}Expand description
A set of edits to one file, awaiting review.
This is the authoritative record of a pending review. Hunk decorations in the
buffer are a projection of it, rebuilt by Self::refresh rather than maintained
in parallel — two mechanisms tracking the same state is how you end up with a proposal
that reads clean in one place and conflicted in the other.
Fields§
§id: ProposalId§path: PathBuf§base_version: Option<Version>The buffer revision this was anchored to, when we could establish one (§5).
None means the agent read the file by some other means and we anchored by
content instead.
base_text: StringThe file as the agent saw it. Immutable — ADR-0006 §3 keeps the original so the
agent can always be re-asked with the exact context it authored against, and so
Self::refresh can recompute from a fixed point rather than accumulating drift.
proposed_text: StringThe file as the agent proposed it. Immutable, same reasons.
hunks: Vec<Hunk>Implementations§
Source§impl EditProposal
impl EditProposal
Sourcepub fn new(
id: ProposalId,
path: PathBuf,
base_version: Option<Version>,
base_text: String,
proposed_text: String,
current_text: &str,
) -> Self
pub fn new( id: ProposalId, path: PathBuf, base_version: Option<Version>, base_text: String, proposed_text: String, current_text: &str, ) -> Self
Build a proposal from a whole-file diff, anchored onto current_text.
Sourcepub fn refresh(&mut self, current_text: &str)
pub fn refresh(&mut self, current_text: &str)
Recompute the hunks against the buffer as it stands now.
Idempotent, and derived from the immutable original every time rather than from the last result, so repeated calls cannot accumulate error. Cheap enough to run on every edit for realistic proposals; ADR-0006 §3 notes it can be made lazy if that ever stops being true.
Sourcepub fn applicable(&self) -> impl Iterator<Item = &Hunk>
pub fn applicable(&self) -> impl Iterator<Item = &Hunk>
Hunks that would actually apply if accepted right now.
pub fn has_conflicts(&self) -> bool
Sourcepub fn is_settled(&self) -> bool
pub fn is_settled(&self) -> bool
Whether there is nothing left to review — every hunk applied or resolved itself.
Trait Implementations§
Source§impl Clone for EditProposal
impl Clone for EditProposal
Source§fn clone(&self) -> EditProposal
fn clone(&self) -> EditProposal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more