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:
@@ -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",
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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">` +
|
||||||
|
|||||||
@@ -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(">>"); // sanity: markers not escaped as text
|
expect(html).not.toContain(">>"); // 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";
|
||||||
|
|||||||
Reference in New Issue
Block a user