Reject on an optimistically-applied proposal now restores the retained original even after interior tweaks: appliedSpans tracked-range fallback (pure shiftTracked, boundary-straddle distrust, close-clears, rebuild-only resync), honest hard failure with a Discard action, INV-16 read-only guards, rejectAll {reverted,skipped} reporting on all batch surfaces, CodeLens reachability at the tracked span. 312 unit + 94/5 host E2E.
Closes #70.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit was merged in pull request #73.
This commit is contained in:
@@ -226,9 +226,16 @@ export class EditorProposalController implements vscode.Disposable, vscode.CodeL
|
||||
if (document.languageId !== "markdown") return [];
|
||||
if (!this.registry.isCoediting(document.uri)) return [];
|
||||
const key = this.proposals.keyFor(document);
|
||||
const applied = this.proposals
|
||||
.listProposals(document)
|
||||
.filter((v) => v.anchorStart !== null && this.proposals.isApplied(key, v.id));
|
||||
// #70: an interior tweak orphans the exact anchor (anchorStart null) but the
|
||||
// proposal stays fully decidable — Keep by id, Reject via the tracked span —
|
||||
// so the lens pair anchors at the tracked span instead of vanishing (which
|
||||
// made the fixed reject path unreachable from the primary gesture surface).
|
||||
const applied: { id: string; at: number }[] = [];
|
||||
for (const v of this.proposals.listProposals(document)) {
|
||||
if (!this.proposals.isApplied(key, v.id)) continue;
|
||||
const at = v.anchorStart ?? this.proposals.trackedSpan(key, v.id)?.start;
|
||||
if (at !== undefined) applied.push({ id: v.id, at });
|
||||
}
|
||||
const lenses: vscode.CodeLens[] = [];
|
||||
if (applied.length >= 2) {
|
||||
const top = new vscode.Range(0, 0, 0, 0);
|
||||
@@ -238,7 +245,7 @@ export class EditorProposalController implements vscode.Disposable, vscode.CodeL
|
||||
);
|
||||
}
|
||||
for (const v of applied) {
|
||||
const pos = document.positionAt(v.anchorStart!);
|
||||
const pos = document.positionAt(v.at);
|
||||
const line = new vscode.Range(pos.line, 0, pos.line, 0);
|
||||
lenses.push(
|
||||
new vscode.CodeLens(line, { title: "✓ Keep", command: "cowriting.proposalAcceptMenu", arguments: [v.id] }),
|
||||
@@ -261,10 +268,12 @@ export class EditorProposalController implements vscode.Disposable, vscode.CodeL
|
||||
if (!pick) return;
|
||||
const all = pick.includes("ALL");
|
||||
if (kind === "accept") {
|
||||
if (all) await this.proposals.acceptAllProposals(doc);
|
||||
// The batch commands own the applied/skipped reporting (#70: a silent:true
|
||||
// batch with a discarded tally re-creates the silent-skip failure mode).
|
||||
if (all) await vscode.commands.executeCommand("cowriting.acceptAllProposals");
|
||||
else await this.proposals.finalizeInPlace(key, id);
|
||||
} else {
|
||||
if (all) await this.proposals.rejectAll(doc);
|
||||
if (all) await vscode.commands.executeCommand("cowriting.rejectAllProposals");
|
||||
else await this.proposals.revertInPlace(key, id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user