A3: vcs.toggleBlame without a path waits for tabs just opened

Over the control channel, a toggle right after file.open ran before the
new tab was adopted (bufferOpened fetches the buffer first), so it found
no active tab. The editor store now exposes settled() for adoptions in
flight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-31 14:54:22 +01:00
parent c3acd9f60a
commit 765dbf71b7
3 changed files with 31 additions and 4 deletions

View file

@ -37,6 +37,7 @@ import {
useLogStore,
} from "../../src/components/vcs/log/log";
import LogToolWindow from "../../src/components/vcs/log/LogToolWindow.vue";
import { useEditorStore } from "../../src/stores/editor";
import { useNotificationsStore } from "../../src/stores/notifications";
import { useProjectStore } from "../../src/stores/project";
@ -139,6 +140,8 @@ function execute(command: string, p: Record<string, unknown>): Promise<unknown>
truncated: false,
});
}
case "buffer.get":
return Promise.resolve({ id: p.id, path: "src/opened.php", text: "<?php\n", version: 0, dirty: false });
case "git.showAt": {
const text = blobs[`${String(p.rev)}:${String(p.path)}`];
return Promise.resolve({ text: text ?? null, binary: false, tooLarge: false });
@ -511,5 +514,9 @@ describe("blame commands in the main layout (M4.7)", () => {
expect(isBlameShown("src/a.php")).toBe(true);
await commands.execute(TOGGLE_BLAME_COMMAND, { path: "src/a.php" });
expect(isBlameShown("src/a.php")).toBe(false);
useEditorStore(pinia).handleEvent({ kind: "bufferOpened", id: 5 });
await commands.execute(TOGGLE_BLAME_COMMAND, {});
expect(isBlameShown("src/opened.php")).toBe(true);
});
});