F9: authorship view in the rendered preview #27

Merged
benstull merged 9 commits from f9-authorship-preview into main 2026-06-11 21:40:58 +00:00
Showing only changes of commit a84d72e69b - Show all commits
+14
View File
@@ -18,6 +18,7 @@ import { applyChange, coalesce, type LiveSpan } from "./attributionTracker";
import { minimizeReplace, PendingEditRegistry } from "./pendingEdits";
import type { VersionGuard } from "./versionGuard";
import { isAuthorable } from "./workspacePath";
import type { AuthorSpan } from "./trackChangesModel";
/** Test-facing snapshot of live attribution state for a document. */
export interface RenderedSpan {
@@ -400,6 +401,19 @@ export class AttributionController implements vscode.Disposable {
getOrphanCount(docPath: string): number {
return this.docs.get(docPath)?.orphans.length ?? 0;
}
/**
* F9: the document's live attribution as authorship spans for the preview —
* current-buffer char ranges mapped to author kind (agent→claude). Computes
* the document key internally, so callers pass a TextDocument, not the key.
*/
spansFor(document: vscode.TextDocument): AuthorSpan[] {
return this.getSpans(this.keyOf(document)).map((s) => ({
start: s.range.start,
end: s.range.end,
author: s.authorKind === "agent" ? "claude" : "human",
}));
}
isVisible(): boolean {
return this.visible;
}