F9: authorship view in the rendered preview #27
@@ -18,6 +18,7 @@ import { applyChange, coalesce, type LiveSpan } from "./attributionTracker";
|
|||||||
import { minimizeReplace, PendingEditRegistry } from "./pendingEdits";
|
import { minimizeReplace, PendingEditRegistry } from "./pendingEdits";
|
||||||
import type { VersionGuard } from "./versionGuard";
|
import type { VersionGuard } from "./versionGuard";
|
||||||
import { isAuthorable } from "./workspacePath";
|
import { isAuthorable } from "./workspacePath";
|
||||||
|
import type { AuthorSpan } from "./trackChangesModel";
|
||||||
|
|
||||||
/** Test-facing snapshot of live attribution state for a document. */
|
/** Test-facing snapshot of live attribution state for a document. */
|
||||||
export interface RenderedSpan {
|
export interface RenderedSpan {
|
||||||
@@ -400,6 +401,19 @@ export class AttributionController implements vscode.Disposable {
|
|||||||
getOrphanCount(docPath: string): number {
|
getOrphanCount(docPath: string): number {
|
||||||
return this.docs.get(docPath)?.orphans.length ?? 0;
|
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 {
|
isVisible(): boolean {
|
||||||
return this.visible;
|
return this.visible;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user