#1114·hunk

Independent visibility control for left and right extension panes

Author: brettinternetCreated Sep 21, 2026Updated Sep 21, 2026

Context

We are building hunk-guide using a right-side pane registered through the public extension API. The guide pane and the built-in hunk:files pane need independent state, but their visibility is currently coupled through Hunk's shared sidebar area.

docs/extensions.md notes that opening a left or right pane reveals the sidebar area. In practice:

  • Calling ctx.panes.open("guide") reveals the entire sidebar area. If hunk:files on the left was logically open but responsively hidden, opening the right guide pane reveals both the left files pane and the right guide pane.
  • ctx.panes.isOpen("guide") reports logical open preference rather than whether the pane is currently rendered. Consequently, a toggle command can appear to do nothing on the first press, then reveal both panes.
  • Programmatically closing or opening hunk:files as a workaround mutates unrelated pane state and violates pane independence.

This blocks implementing a guide/plain-diff toggle that leaves the files pane exactly as the user set it.

Minimal snippet

typescript
import type { HunkExtensionAPI } from "hunkdiff/extension";

export default function (hunk: HunkExtensionAPI) {
  hunk.registerPane({
    id: "guide",
    title: "Guide",
    placement: "right",
    component: GuidePane,
  });

  hunk.registerCommand(
    { id: "toggle", title: "Toggle Guide" },
    (ctx) => {
      if (ctx.panes.isOpen("guide")) {
        ctx.panes.close("guide");
      } else {
        ctx.panes.open("guide");
      }
    }
  );
}

Request

  • A public way to reveal or toggle one vertical pane edge without revealing panes on the opposite edge.
  • A public way to distinguish logical open state from current rendered visibility.