diff --git a/package.json b/package.json index f8653c8..629ea5b 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,11 @@ "command": "cowriting.pinDiffBaseline", "title": "Cowriting: Pin Diff Baseline to Now", "category": "Cowriting" + }, + { + "command": "cowriting.showTrackChangesPreview", + "title": "Cowriting: Open Track-Changes Preview", + "category": "Cowriting" } ], "menus": { @@ -151,6 +156,11 @@ "command": "cowriting.toggleDiffView", "key": "ctrl+alt+d", "when": "editorTextFocus" + }, + { + "command": "cowriting.showTrackChangesPreview", + "key": "ctrl+alt+r", + "when": "editorLangId == markdown" } ] }, diff --git a/src/extension.ts b/src/extension.ts index bf9965f..be53c2c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -8,6 +8,7 @@ import { buildFingerprint } from "./anchorer"; import { VersionGuard } from "./versionGuard"; import { BaselineStore } from "./baselineStore"; import { DiffViewController } from "./diffViewController"; +import { TrackChangesPreviewController } from "./trackChangesPreview"; const CHANNEL_NAME = "Cowriting (Cline SDK)"; @@ -17,6 +18,7 @@ export interface CowritingApi { proposalController: ProposalController; versionGuard: VersionGuard; diffViewController: DiffViewController; + trackChangesPreviewController: TrackChangesPreviewController; } export function activate(context: vscode.ExtensionContext): CowritingApi | undefined { @@ -56,6 +58,16 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef const diffViewController = new DiffViewController(baselineStore); context.subscriptions.push(diffViewController); + // --- F7: rendered track-changes preview (Feature #21) — workspace-INDEPENDENT --- + // Like F6, F7 works on any markdown doc (incl. untitled / out-of-folder), so it + // is constructed regardless of an open folder and its command is always live. + // It reuses the F6 baseline (INV-20) and adds no persistence. + const trackChangesPreviewController = new TrackChangesPreviewController( + diffViewController, + context.extensionUri, + ); + context.subscriptions.push(trackChangesPreviewController); + // --- F2: region-anchored threads (Feature #4) --- const root = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath; if (!root) { @@ -259,7 +271,14 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef vscode.workspace.textDocuments.forEach(renderIfOpen); context.subscriptions.push(vscode.workspace.onDidOpenTextDocument(renderIfOpen)); - return { threadController, attributionController, proposalController, versionGuard, diffViewController }; + return { + threadController, + attributionController, + proposalController, + versionGuard, + diffViewController, + trackChangesPreviewController, + }; } export function deactivate(): void {