Open Behavior Specification
August 24, 2026 · View on GitHub
Controls how items are opened when clicked or via context menu commands.
Setting
| Setting | Type | Default | Scope |
|---|---|---|---|
git-work-grove.openBehavior | "ask" | "newWindow" | "currentWindow" | "terminal" | "ask" | resource |
Modes
"ask" (default)
Shows a QuickPick with 6 options:
- Open in New Window — opens once in new window
- Open in Current Window — opens once in current window
- Open in Terminal — opens once in terminal
- Always Open in New Window — persists
"newWindow"to global settings, then opens - Always Open in Current Window — persists
"currentWindow"to global settings, then opens - Always Open in Terminal — persists
"terminal"to global settings, then opens terminal
The "Always" options update the setting globally, so future clicks use the new mode.
"newWindow"
Opens the target in a new VS Code window (forceNewWindow: true).
"currentWindow"
Opens the target in the current VS Code window (forceNewWindow: false).
"terminal"
Opens a new VS Code terminal at the item's location instead of opening a window. See Open in Terminal spec for CWD resolution and terminal naming details.
Trigger Points
| Trigger | Behavior |
|---|---|
Click on WorkspaceFileItem | Uses openBehavior setting |
Click on FavoriteItem | Uses openBehavior setting |
Click on WorktreeItem (has children) | Expands/collapses only (no open) |
Click on WorktreeItem (leaf, no workspace files) | Uses openBehavior setting |
Click on GroupHeaderItem (repository, has children) | Expands/collapses only (no open) |
Click on GroupHeaderItem (repository, leaf, no workspace files) | Uses openBehavior setting |
| Context menu "Open in New Window" | Always new window (ignores setting) |
| Context menu "Open in Current Window" | Always current window (ignores setting) |
| Context menu "Open in Terminal" | Always opens terminal (ignores setting) |
URI Resolution
All open commands resolve a vscode.Uri from the tree item:
| Item type | Property used |
|---|---|
FavoriteItem | favoritePath |
WorkspaceFileItem | workspaceFileInfo.path |
WorktreeItem | worktreeInfo.path |
Detection order: "favoritePath" in item → "workspaceFileInfo" in item → "worktreeInfo" in item
Current Item Skip
When clicking items via onDidChangeSelection, items with "current" in their contextValue are skipped — reopening the already-open item is a no-op.
Implementation
openFolder()— delegates tovscode.commands.executeCommand("vscode.openFolder", uri, { forceNewWindow })askAndOpen()— shows QuickPick, optionally persists settingopenWithBehavior()— dispatches based on current settingopenDefault()— entry point for click handler, reads setting and delegates