F6: diff-view toggle (Feature #17) #18
+19
-1
@@ -6,6 +6,8 @@ import { AttributionController } from "./attributionController";
|
||||
import { ProposalController } from "./proposalController";
|
||||
import { buildFingerprint } from "./anchorer";
|
||||
import { VersionGuard } from "./versionGuard";
|
||||
import { BaselineStore } from "./baselineStore";
|
||||
import { DiffViewController } from "./diffViewController";
|
||||
|
||||
const CHANNEL_NAME = "Cowriting (Cline SDK)";
|
||||
|
||||
@@ -14,6 +16,7 @@ export interface CowritingApi {
|
||||
attributionController: AttributionController;
|
||||
proposalController: ProposalController;
|
||||
versionGuard: VersionGuard;
|
||||
diffViewController: DiffViewController;
|
||||
}
|
||||
|
||||
export function activate(context: vscode.ExtensionContext): CowritingApi | undefined {
|
||||
@@ -63,6 +66,8 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef
|
||||
"cowriting.acceptProposal",
|
||||
"cowriting.rejectProposal",
|
||||
"cowriting.proposeAgentEdit",
|
||||
"cowriting.toggleDiffView",
|
||||
"cowriting.pinDiffBaseline",
|
||||
]) {
|
||||
context.subscriptions.push(vscode.commands.registerCommand(command, stub));
|
||||
}
|
||||
@@ -83,6 +88,18 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef
|
||||
const proposalController = new ProposalController(store, attributionController, root, versionGuard);
|
||||
context.subscriptions.push(proposalController);
|
||||
|
||||
// --- F6: diff-view toggle (Feature #17) ---
|
||||
// Baseline lives in VS Code workspace storage, never the repo (INV-19).
|
||||
// storageUri can be undefined in odd host states → in-memory fallback (§6.5).
|
||||
const storageDir = context.storageUri?.fsPath;
|
||||
const baselineStore = storageDir ? new BaselineStore(storageDir) : null;
|
||||
const diffViewController = new DiffViewController(baselineStore, root);
|
||||
context.subscriptions.push(diffViewController);
|
||||
// The seam's single machine-landing signal advances the baseline (INV-18).
|
||||
context.subscriptions.push(
|
||||
attributionController.onDidApplyAgentEdit((e) => diffViewController.advance(e.document)),
|
||||
);
|
||||
|
||||
// One SHARED sidecar watcher for both controllers; self-writes are
|
||||
// suppressed centrally in the store (the sidecar is co-owned).
|
||||
const watcher = vscode.workspace.createFileSystemWatcher("**/.threads/**/*.json");
|
||||
@@ -228,12 +245,13 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef
|
||||
threadController.renderAll(doc);
|
||||
attributionController.loadAll(doc);
|
||||
proposalController.renderAll(doc);
|
||||
diffViewController.ensureBaseline(doc);
|
||||
}
|
||||
};
|
||||
vscode.workspace.textDocuments.forEach(renderIfOpen);
|
||||
context.subscriptions.push(vscode.workspace.onDidOpenTextDocument(renderIfOpen));
|
||||
|
||||
return { threadController, attributionController, proposalController, versionGuard };
|
||||
return { threadController, attributionController, proposalController, versionGuard, diffViewController };
|
||||
}
|
||||
|
||||
export function deactivate(): void {
|
||||
|
||||
Reference in New Issue
Block a user