feat(f7): register showTrackChangesPreview command + keybinding, wire controller (#21)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -83,6 +83,11 @@
|
|||||||
"command": "cowriting.pinDiffBaseline",
|
"command": "cowriting.pinDiffBaseline",
|
||||||
"title": "Cowriting: Pin Diff Baseline to Now",
|
"title": "Cowriting: Pin Diff Baseline to Now",
|
||||||
"category": "Cowriting"
|
"category": "Cowriting"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "cowriting.showTrackChangesPreview",
|
||||||
|
"title": "Cowriting: Open Track-Changes Preview",
|
||||||
|
"category": "Cowriting"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"menus": {
|
"menus": {
|
||||||
@@ -151,6 +156,11 @@
|
|||||||
"command": "cowriting.toggleDiffView",
|
"command": "cowriting.toggleDiffView",
|
||||||
"key": "ctrl+alt+d",
|
"key": "ctrl+alt+d",
|
||||||
"when": "editorTextFocus"
|
"when": "editorTextFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "cowriting.showTrackChangesPreview",
|
||||||
|
"key": "ctrl+alt+r",
|
||||||
|
"when": "editorLangId == markdown"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
+20
-1
@@ -8,6 +8,7 @@ import { buildFingerprint } from "./anchorer";
|
|||||||
import { VersionGuard } from "./versionGuard";
|
import { VersionGuard } from "./versionGuard";
|
||||||
import { BaselineStore } from "./baselineStore";
|
import { BaselineStore } from "./baselineStore";
|
||||||
import { DiffViewController } from "./diffViewController";
|
import { DiffViewController } from "./diffViewController";
|
||||||
|
import { TrackChangesPreviewController } from "./trackChangesPreview";
|
||||||
|
|
||||||
const CHANNEL_NAME = "Cowriting (Cline SDK)";
|
const CHANNEL_NAME = "Cowriting (Cline SDK)";
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ export interface CowritingApi {
|
|||||||
proposalController: ProposalController;
|
proposalController: ProposalController;
|
||||||
versionGuard: VersionGuard;
|
versionGuard: VersionGuard;
|
||||||
diffViewController: DiffViewController;
|
diffViewController: DiffViewController;
|
||||||
|
trackChangesPreviewController: TrackChangesPreviewController;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function activate(context: vscode.ExtensionContext): CowritingApi | undefined {
|
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);
|
const diffViewController = new DiffViewController(baselineStore);
|
||||||
context.subscriptions.push(diffViewController);
|
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) ---
|
// --- F2: region-anchored threads (Feature #4) ---
|
||||||
const root = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
|
const root = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
|
||||||
if (!root) {
|
if (!root) {
|
||||||
@@ -259,7 +271,14 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef
|
|||||||
vscode.workspace.textDocuments.forEach(renderIfOpen);
|
vscode.workspace.textDocuments.forEach(renderIfOpen);
|
||||||
context.subscriptions.push(vscode.workspace.onDidOpenTextDocument(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 {
|
export function deactivate(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user