Skip to content

Independent visibility control for left and right extension panes #1114

Description

@brettinternet

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions