feat: color pending proposal blocks by author (Claude blue/purple)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
BenStullsBets
2026-06-26 14:17:40 -07:00
parent 44ef0a21db
commit 2955e8d929
3 changed files with 13 additions and 2 deletions
+1
View File
@@ -94,6 +94,7 @@ export class ProposalController implements vscode.Disposable {
replaced: p.original ?? fp?.text ?? "", replaced: p.original ?? fp?.text ?? "",
replacement: p.replacement, replacement: p.replacement,
original: p.original, original: p.original,
author: p.author?.kind === "agent" ? "claude" : "human",
}; };
}); });
} }
+5 -2
View File
@@ -837,6 +837,8 @@ export interface ProposalView {
replacement: string; replacement: string;
/** F12/#64 (INV-48): the pre-apply original, set after optimistic apply. */ /** F12/#64 (INV-48): the pre-apply original, set after optimistic apply. */
original?: string; original?: string;
/** Who made the proposal — colors the del/ins. Defaults to "claude". */
author?: AuthorKind;
} }
function proposalBlockHtml(p: ProposalView, render: (src: string) => string): string { function proposalBlockHtml(p: ProposalView, render: (src: string) => string): string {
@@ -848,8 +850,9 @@ function proposalBlockHtml(p: ProposalView, render: (src: string) => string): st
} }
}; };
const unanchored = p.anchorStart === null ? " cw-proposal-unanchored" : ""; const unanchored = p.anchorStart === null ? " cw-proposal-unanchored" : "";
const before = p.replaced ? `<del class="cw-del">${safe(p.replaced)}</del>` : ""; const who = p.author ?? "claude";
const after = `<ins class="cw-add">${safe(p.replacement)}</ins>`; const before = p.replaced ? `<del class="cw-del-${who}">${safe(p.replaced)}</del>` : "";
const after = `<ins class="cw-ins-${who}">${safe(p.replacement)}</ins>`;
const actions = const actions =
`<span class="cw-actions">` + `<span class="cw-actions">` +
`<span class="cw-btngroup">` + `<span class="cw-btngroup">` +
+7
View File
@@ -503,6 +503,13 @@ describe("renderReview", () => {
expect(html).toContain("cw-ins-human"); // author-colored insertion expect(html).toContain("cw-ins-human"); // author-colored insertion
expect(html).not.toContain("&gt;&gt;"); // sanity: markers not escaped as text expect(html).not.toContain("&gt;&gt;"); // sanity: markers not escaped as text
}); });
test("renderReview: a proposal block colors its del/ins by author (claude default)", () => {
const proposals: ProposalView[] = [{ id: "p1", anchorStart: 0, anchorEnd: 5, replaced: "hello", replacement: "goodbye" }];
const html = renderReview("hello", "hello", [], proposals);
expect(html).toContain('cw-del-claude');
expect(html).toContain('cw-ins-claude');
});
}); });
import { renderTrackChanges as rtc2 } from "../src/trackChangesModel"; import { renderTrackChanges as rtc2 } from "../src/trackChangesModel";