Skip to content

Commit

Permalink
Closes #3053 adds open in integrated terminal
Browse files Browse the repository at this point in the history
Adds terminal & integrated terminal to upstream status
  • Loading branch information
eamodio committed Dec 12, 2023
1 parent 971f1fa commit cd475ef
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Requires VS Code `1.85` or later and `multiDiffEditor.experimental.enabled` to be enabled
- Adds a confirmation prompt when attempting to undo a commit with uncommitted changes
- Adds a _[Show|Hide] Merge Commits_ toggle to the _Contributors_ view
- Adds _Open in Integrated Terminal_ command to repositories in the views — closes [#3053](https://github.com/gitkraken/vscode-gitlens/issues/3053)
- Adds _Open in Terminal_ & _Open in Integrated Terminal_ commands to the upstream status in the _Commits_ view

### Changed

Expand Down
45 changes: 37 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6365,6 +6365,11 @@
"title": "Open in Terminal",
"category": "GitLens"
},
{
"command": "gitlens.views.openInIntegratedTerminal",
"title": "Open in Integrated Terminal",
"category": "GitLens"
},
{
"command": "gitlens.views.setAsDefault",
"title": "Set as Default",
Expand Down Expand Up @@ -9512,6 +9517,10 @@
"command": "gitlens.views.openInTerminal",
"when": "false"
},
{
"command": "gitlens.views.openInIntegratedTerminal",
"when": "false"
},
{
"command": "gitlens.views.setAsDefault",
"when": "false"
Expand Down Expand Up @@ -13100,15 +13109,20 @@
"group": "2_gitlens_quickopen@1"
},
{
"command": "gitlens.openRepoOnRemote",
"when": "viewItem =~ /gitlens:repository\\b/ && gitlens:hasRemotes",
"group": "2_gitlens_quickopen@2",
"alt": "gitlens.copyRemoteRepositoryUrl"
"command": "gitlens.views.openInIntegratedTerminal",
"when": "!gitlens:hasVirtualFolders && viewItem =~ /gitlens:repository\\b/",
"group": "2_gitlens_quickopen@2"
},
{
"command": "gitlens.views.revealRepositoryInExplorer",
"when": "viewItem =~ /gitlens:repository\\b(?!.*?\\b\\+workspace\\b)/",
"group": "2_gitlens_quickopen@2"
"group": "2_gitlens_quickopen@3"
},
{
"command": "gitlens.openRepoOnRemote",
"when": "viewItem =~ /gitlens:repository\\b/ && gitlens:hasRemotes",
"group": "2_gitlens_quickopen@4",
"alt": "gitlens.copyRemoteRepositoryUrl"
},
{
"command": "gitlens.showCommitSearch",
Expand Down Expand Up @@ -13201,10 +13215,15 @@
"when": "!gitlens:hasVirtualFolders && viewItem =~ /gitlens:repo-folder\\b/",
"group": "2_gitlens_quickopen@1"
},
{
"command": "gitlens.views.openInIntegratedTerminal",
"when": "!gitlens:hasVirtualFolders && viewItem =~ /gitlens:repo-folder\\b/",
"group": "2_gitlens_quickopen@2"
},
{
"command": "gitlens.openRepoOnRemote",
"when": "viewItem =~ /gitlens:repo-folder\\b/ && gitlens:hasRemotes",
"group": "2_gitlens_quickopen@2",
"group": "2_gitlens_quickopen@3",
"alt": "gitlens.copyRemoteRepositoryUrl"
},
{
Expand Down Expand Up @@ -13329,10 +13348,20 @@
"when": "gitlens:hasRemotes && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && gitlens:action:createPullRequest && viewItem =~ /gitlens:status:upstream:(?!(missing|none))/",
"group": "1_gitlens_secondary_actions@3"
},
{
"command": "gitlens.views.openInTerminal",
"when": "!gitlens:hasVirtualFolders && viewItem =~ /gitlens:status:upstream\\b/",
"group": "2_gitlens_quickopen@1"
},
{
"command": "gitlens.views.openInIntegratedTerminal",
"when": "!gitlens:hasVirtualFolders && viewItem =~ /gitlens:status:upstream\\b/",
"group": "2_gitlens_quickopen@2"
},
{
"command": "gitlens.openBranchOnRemote",
"when": "gitlens:hasRemotes && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && viewItem =~ /gitlens:status:upstream:(?!(missing|none))/",
"group": "2_gitlens_quickopen@1",
"when": "gitlens:hasRemotes && viewItem =~ /gitlens:status:upstream:(?!(missing|none))/",
"group": "2_gitlens_quickopen@3",
"alt": "gitlens.copyRemoteBranchUrl"
},
{
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ export type CoreCommands =
| 'editor.action.webvieweditor.showFind'
| 'editorScroll'
| 'list.collapseAllToFocus'
| 'openInIntegratedTerminal'
| 'openInTerminal'
| 'revealFileInOS'
| 'revealInExplorer'
Expand Down
14 changes: 11 additions & 3 deletions src/views/viewCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export class ViewCommands {
registerViewCommand('gitlens.views.unsetAsDefault', this.unsetAsDefault, this);

registerViewCommand('gitlens.views.openInTerminal', this.openInTerminal, this);
registerViewCommand('gitlens.views.openInIntegratedTerminal', this.openInIntegratedTerminal, this);
registerViewCommand('gitlens.views.star', this.star, this);
registerViewCommand('gitlens.views.unstar', this.unstar, this);

Expand Down Expand Up @@ -576,10 +577,17 @@ export class ViewCommands {
}

@log()
private openInTerminal(node: RepositoryNode | RepositoryFolderNode) {
if (!node.isAny('repository', 'repo-folder')) return Promise.resolve();
private openInTerminal(node: BranchTrackingStatusNode | RepositoryNode | RepositoryFolderNode) {
if (!node.isAny('tracking-status', 'repository', 'repo-folder')) return Promise.resolve();

return executeCoreCommand('openInTerminal', Uri.file(node.repo.path));
return executeCoreCommand('openInTerminal', Uri.file(node.repoPath));
}

@log()
private openInIntegratedTerminal(node: BranchTrackingStatusNode | RepositoryNode | RepositoryFolderNode) {
if (!node.isAny('tracking-status', 'repository', 'repo-folder')) return Promise.resolve();

return executeCoreCommand('openInIntegratedTerminal', Uri.file(node.repoPath));
}

@log()
Expand Down

0 comments on commit cd475ef

Please sign in to comment.