-
Notifications
You must be signed in to change notification settings - Fork 1
Add Open in Terminal command #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| "git-work-grove": minor | ||
| --- | ||
|
|
||
| Add Open in Terminal command for worktrees and workspace files | ||
|
|
||
| - New context menu and inline button to open a terminal at any item's location | ||
| - Terminal CWD resolves to the worktree directory (or parent directory for workspace files) | ||
| - Customizable terminal name templates for all 4 item types | ||
| - Added "terminal" option to the openBehavior setting | ||
| - Leaf worktrees/repository (no workspace files) now respond to clicks via openBehavior | ||
| - QuickPick includes "Open in Terminal" and "Always Open in Terminal" options |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # Open in Terminal Specification | ||
|
|
||
| Opens a new VS Code terminal at the item's filesystem location. | ||
|
|
||
| ## Command | ||
|
|
||
| | Command ID | Title | Icon | | ||
| |---|---|---| | ||
| | `gitWorkGrove.openInTerminal` | Open in Terminal | `$(terminal)` | | ||
|
|
||
| ## CWD Resolution | ||
|
|
||
| The working directory depends on the item type: | ||
|
|
||
| | Item type | CWD | | ||
| |---|---| | ||
| | `GroupHeaderItem` (repository) | `worktreeInfo.path` | | ||
| | `WorktreeItem` | `worktreeInfo.path` | | ||
| | `WorkspaceFileItem` | `dirname(workspaceFileInfo.path)` | | ||
| | `FavoriteItem` | Resolved via duck-typing (see detection order below) | | ||
|
|
||
| ### Detection Order (duck-typing) | ||
|
|
||
| Same order as `resolveUri` in `open-behavior.md`: | ||
|
|
||
| 1. `"favoritePath" in item` → resolve to underlying type | ||
| 2. `"workspaceFileInfo" in item` → `dirname(workspaceFileInfo.path)` | ||
| 3. `"worktreeInfo" in item && item.worktreeInfo` → `worktreeInfo.path` | ||
|
|
||
| ## Terminal Naming | ||
|
|
||
| The terminal name is rendered from `template.*.terminalName` settings. Only 4 templates exist (one per non-favorite type). Favorites reuse the corresponding non-favorite template. | ||
|
|
||
| | Item type | Template setting | | ||
| |---|---| | ||
| | Repository | `template.repository.terminalName` | | ||
| | Worktree | `template.worktree.terminalName` | | ||
| | Repository Workspace | `template.repositoryWorkspace.terminalName` | | ||
| | Worktree Workspace | `template.worktreeWorkspace.terminalName` | | ||
|
|
||
| ### Defaults | ||
|
|
||
| | Setting | Default | | ||
| |---|---| | ||
| | `template.repository.terminalName` | `{ref}` | | ||
| | `template.worktree.terminalName` | `{ref}` | | ||
| | `template.repositoryWorkspace.terminalName` | `{name}` | | ||
| | `template.worktreeWorkspace.terminalName` | `{name} ({ref})` | | ||
|
|
||
| Templates use the same variables and syntax as label/description templates. See [templates.md](templates.md) for variable reference. | ||
|
|
||
| ## Prunable Worktree Guard | ||
|
|
||
| Before creating the terminal, checks `fs.existsSync(cwd)`. If the directory does not exist (prunable worktree), shows a warning message instead of creating the terminal. | ||
|
|
||
| ## Error Handling | ||
|
|
||
| The `createTerminal` call is wrapped in a try/catch. On failure, shows an error message via `showErrorMessage` and logs the error via `logError`. | ||
|
|
||
| ## Integration with openBehavior | ||
|
|
||
| The `openBehavior` setting now accepts `"terminal"` as a fourth option. When set, clicking an item (at trigger points listed in [open-behavior.md](open-behavior.md)) opens a terminal instead of a window. | ||
|
|
||
| Leaf worktree and repository items (`CollapsibleState.None`, i.e., no workspace files found) now trigger `openBehavior` on click. Previously these clicks were inert (only expand/collapse applied, and leaf items had nothing to expand). | ||
|
|
||
| ## Menu Placement | ||
|
|
||
| - **Context menu**: `navigation@4` — appears for all actionable item types | ||
| - **Inline button**: `$(terminal)` icon on non-favorite items only (favorites already have 3 inline buttons: remove, move up, move down) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.