Skip to content

Commit 36913a3

Browse files
committed
Closes #1284 - adds terminal links setting
1 parent 8d41664 commit 36913a3

File tree

5 files changed

+36
-3
lines changed

5 files changed

+36
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
2020
- Adds a _Push to Commit..._ command to unpublished commits in the _Commits_, _Branches_, and _Repositories_ views, and to to unpublished files in the _File History_ and _Line History_ views
2121
- Adds a welcome, i.e. richer empty state, to the _Search & Compare_ view
2222
- Adds a `gitlens.integrations.enabled` setting to specify whether to enable rich integrations with any supported remote services — see [#1208](https://github.com/eamodio/vscode-gitlens/issues/1208)
23+
- Adds a `gitlens.terminalLinks.enabled` setting to specify whether to enable terminal links — autolinks in the integrated terminal to quickly jump to more details for commits, branches, tags, and more — closes [#1284](https://github.com/eamodio/vscode-gitlens/issues/1284)
2324
- Adds a `gitlens.showWelcomeOnInstall` setting to specify whether to show the Welcome (Quick Setup) experience on first install — closes [#1049](https://github.com/eamodio/vscode-gitlens/issues/1049) thanks to [PR #1258](https://github.com/eamodio/vscode-gitlens/pull/1258) by Rickard ([@rickardp](https://github.com/rickardp))
2425
- Adds extensibility APIs
2526
- Adds an _action runner_ extensibility point to provide a runner (handler) for the new _createPullRequest_ and _openPullRequest_ actions — see [`gitlens.d.ts`](https://github.com/eamodio/vscode-gitlens/blob/main/src/api/gitlens.d.ts) for API definitions

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,8 @@ The _Search & Compare_ view lists pinnable (saved) results for searching commit
560560
<img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/main/images/docs/terminal-links.gif" alt="Terminal Links" />
561561
</p>
562562

563-
- Adds autolinks for branches, tags, and commit ranges in the integrated terminal to quickly explore their commit history
564-
- Adds autolinks for commits in the integrated terminal to quickly explore the commit and take action upon it
563+
- [Optionally](##terminal-links-settings- 'Jump to the Terminal Links settings') adds autolinks for branches, tags, and commit ranges in the integrated terminal to quickly explore their commit history
564+
- [Optionally](##terminal-links-settings- 'Jump to the Terminal Links settings') adds autolinks for commits in the integrated terminal to quickly explore the commit and take action upon it
565565

566566
## Remote Provider Integrations [#](#remote-provider-integrations- 'Remote Provider Integrations')
567567

@@ -895,6 +895,12 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
895895
| `gitlens.gitCommands.skipConfirmations` | Specifies which (and when) Git commands will skip the confirmation step, using the format: `git-command-name:(menu/command)` |
896896
| `gitlens.gitCommands.sortBy` | Specifies how Git commands are sorted in the _Git Command Palette_<br /><br />`name` - sorts commands by name<br />`usage` - sorts commands by last used date |
897897

898+
## Terminal Links Settings [#](#terminal-links-settings- 'Terminal Links Settings')
899+
900+
| Name | Description |
901+
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
902+
| `gitlens.terminalLinks.enabled` | Specifies whether to enable terminal links &mdash; autolinks in the integrated terminal to quickly jump to more details for commits, branches, tags, and more |
903+
898904
## Remote Provider Integration Settings [#](#remote-provider-integration-settings- 'Remote Provider Integration Settings')
899905

900906
| Name | Description |

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,12 @@
16331633
"markdownDescription": "Specifies the string to be shown in place of the _authors_ code lens when there are unsaved changes",
16341634
"scope": "window"
16351635
},
1636+
"gitlens.terminalLinks.enabled": {
1637+
"type": "boolean",
1638+
"default": true,
1639+
"markdownDescription": "Specifies whether to enable terminal links &mdash; autolinks in the integrated terminal to quickly jump to more details for commits, branches, tags, and more",
1640+
"scope": "window"
1641+
},
16361642
"gitlens.views.branches.avatars": {
16371643
"type": "boolean",
16381644
"default": true,

src/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ export interface Config {
136136
};
137137
};
138138
};
139+
terminalLinks: {
140+
enabled: boolean;
141+
};
139142
views: ViewsConfig;
140143
advanced: AdvancedConfig;
141144
}

src/container.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export class Container {
4040
| ((e: ConfigurationChangeEvent) => ConfigurationChangeEvent)
4141
| undefined;
4242

43+
private static _terminalLinks: GitTerminalLinkProvider | undefined;
44+
4345
static initialize(extensionId: string, context: ExtensionContext, config: Config) {
4446
this._extensionId = extensionId;
4547
this._context = context;
@@ -96,7 +98,22 @@ export class Container {
9698
}
9799

98100
context.subscriptions.push((this._rebaseEditor = new RebaseEditorProvider()));
99-
context.subscriptions.push(new GitTerminalLinkProvider());
101+
102+
if (config.terminalLinks.enabled) {
103+
context.subscriptions.push((this._terminalLinks = new GitTerminalLinkProvider()));
104+
}
105+
106+
context.subscriptions.push(
107+
configuration.onDidChange(e => {
108+
if (!configuration.changed(e, 'terminalLinks', 'enabled')) return;
109+
110+
this._terminalLinks?.dispose();
111+
if (Container.config.terminalLinks.enabled) {
112+
context.subscriptions.push((this._terminalLinks = new GitTerminalLinkProvider()));
113+
}
114+
}),
115+
);
116+
100117
context.subscriptions.push(new GitFileSystemProvider());
101118

102119
context.subscriptions.push(configuration.onWillChange(this.onConfigurationChanging, this));

0 commit comments

Comments
 (0)