Native surfaces migration — evolve the extension onto VS Code's native review surfaces (9-task plan, spec v0.2.1) (#72)

This commit was merged in pull request #72.
This commit is contained in:
2026-07-02 23:09:37 +00:00
parent 93eeaf13b8
commit 935fcc35ee
54 changed files with 3689 additions and 1995 deletions
+16
View File
@@ -18,6 +18,9 @@ async function openSample(): Promise<vscode.TextDocument> {
const uri = vscode.Uri.file(path.join(WS, DOC_REL));
const doc = await vscode.workspace.openTextDocument(uri);
await vscode.window.showTextDocument(doc);
// INV-10: thread creation/rendering is gated on coediting (Task 4) — idempotent
// across this order-dependent suite's repeated openSample() calls.
await vscode.commands.executeCommand("cowriting.coeditDocument");
return doc;
}
@@ -38,6 +41,17 @@ async function getApi(): Promise<CowritingApi> {
return api;
}
// Task 6 (D10): every human comment on a coedited doc now also fires the
// respond-in-thread turn (createThreadOnSelection/reply). This suite predates
// that loop and asserts exact message sequences unrelated to it — stub the
// turn to reject so the loop runs harmlessly (no real @cline/sdk call, and no
// extra machine message lands in the sidecar this suite's assertions read).
function stubReplyLoop(api: CowritingApi): void {
api.threadController.setTurnRunnerForTest(async () => {
throw new Error("F2 suite: reply-loop turn stubbed off (not under test here)");
});
}
// Reaches the controller's internal docs map for reply/resolve handlers (which
// expect a live vscode.CommentThread). Spec §6.8 "drive the ThreadController and
// assert Comments-controller state" fallback.
@@ -64,6 +78,7 @@ suite("F2 region-anchored threads (host E2E)", () => {
test("create on selection persists a thread sidecar", async () => {
const doc = await openSample();
const api = await getApi();
stubReplyLoop(api);
const start = doc.getText().indexOf("quick brown fox");
const editor = vscode.window.activeTextEditor!;
editor.selection = new vscode.Selection(doc.positionAt(start), doc.positionAt(start + "quick brown fox".length));
@@ -86,6 +101,7 @@ suite("F2 region-anchored threads (host E2E)", () => {
test("reply appends and resolve flips status, both persisted", async () => {
const api = await getApi();
stubReplyLoop(api);
const art0 = readSidecar();
const threadId = art0.threads[0].id;