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

@ -35,7 +35,8 @@
* path, of the active editor tab's file); neither has a default shortcut.
* `vcs.showCommit {hash}` (M4.7) shows the Log with that commit selected
* (a click on a blame annotation); `vcs.toggleBlame {path?}` shows or
* hides the blame annotations of a file (default: the active tab's). No
* hides the blame annotations of a file (default: the active tab's, once
* tabs for buffers just opened are adopted). No
* default shortcuts.
*
* A slim header bar along the top (M3.9) holds the app menu
@ -248,8 +249,11 @@ onMounted(() => {
enabled: () => project.root !== null,
}),
commands.provide(TOGGLE_BLAME_COMMAND, {
run: (params) => {
run: async (params) => {
const given = (params as { path?: unknown } | null)?.path;
if (typeof given !== "string" || given === "") {
await editor.settled();
}
const path = typeof given === "string" && given !== "" ? given : editor.activeTab?.path;
if (path !== undefined) {
toggleBlame(path);