From 36913a35522123256fb2d8fb6c5556069702dcb5 Mon Sep 17 00:00:00 2001
From: Eric Amodio
Date: Wed, 23 Dec 2020 03:43:03 -0500
Subject: [PATCH] Closes #1284 - adds terminal links setting
---
CHANGELOG.md | 1 +
README.md | 10 ++++++++--
package.json | 6 ++++++
src/config.ts | 3 +++
src/container.ts | 19 ++++++++++++++++++-
5 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8b483f1..030fae2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- 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
- Adds a welcome, i.e. richer empty state, to the _Search & Compare_ view
- 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)
+- 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)
- 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))
- Adds extensibility APIs
- 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
diff --git a/README.md b/README.md
index 0200a73..4c4ba10 100644
--- a/README.md
+++ b/README.md
@@ -560,8 +560,8 @@ The _Search & Compare_ view lists pinnable (saved) results for searching commit
-- Adds autolinks for branches, tags, and commit ranges in the integrated terminal to quickly explore their commit history
-- Adds autolinks for commits in the integrated terminal to quickly explore the commit and take action upon it
+- [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
+- [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
## Remote Provider Integrations [#](#remote-provider-integrations- 'Remote Provider Integrations')
@@ -895,6 +895,12 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
| `gitlens.gitCommands.skipConfirmations` | Specifies which (and when) Git commands will skip the confirmation step, using the format: `git-command-name:(menu/command)` |
| `gitlens.gitCommands.sortBy` | Specifies how Git commands are sorted in the _Git Command Palette_
`name` - sorts commands by name
`usage` - sorts commands by last used date |
+## Terminal Links Settings [#](#terminal-links-settings- 'Terminal Links Settings')
+
+| Name | Description |
+| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `gitlens.terminalLinks.enabled` | Specifies whether to enable terminal links — autolinks in the integrated terminal to quickly jump to more details for commits, branches, tags, and more |
+
## Remote Provider Integration Settings [#](#remote-provider-integration-settings- 'Remote Provider Integration Settings')
| Name | Description |
diff --git a/package.json b/package.json
index 46392c7..cab1990 100644
--- a/package.json
+++ b/package.json
@@ -1633,6 +1633,12 @@
"markdownDescription": "Specifies the string to be shown in place of the _authors_ code lens when there are unsaved changes",
"scope": "window"
},
+ "gitlens.terminalLinks.enabled": {
+ "type": "boolean",
+ "default": true,
+ "markdownDescription": "Specifies whether to enable terminal links — autolinks in the integrated terminal to quickly jump to more details for commits, branches, tags, and more",
+ "scope": "window"
+ },
"gitlens.views.branches.avatars": {
"type": "boolean",
"default": true,
diff --git a/src/config.ts b/src/config.ts
index bead2d0..d2b3ec0 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -136,6 +136,9 @@ export interface Config {
};
};
};
+ terminalLinks: {
+ enabled: boolean;
+ };
views: ViewsConfig;
advanced: AdvancedConfig;
}
diff --git a/src/container.ts b/src/container.ts
index 7b7ded9..ac9f124 100644
--- a/src/container.ts
+++ b/src/container.ts
@@ -40,6 +40,8 @@ export class Container {
| ((e: ConfigurationChangeEvent) => ConfigurationChangeEvent)
| undefined;
+ private static _terminalLinks: GitTerminalLinkProvider | undefined;
+
static initialize(extensionId: string, context: ExtensionContext, config: Config) {
this._extensionId = extensionId;
this._context = context;
@@ -96,7 +98,22 @@ export class Container {
}
context.subscriptions.push((this._rebaseEditor = new RebaseEditorProvider()));
- context.subscriptions.push(new GitTerminalLinkProvider());
+
+ if (config.terminalLinks.enabled) {
+ context.subscriptions.push((this._terminalLinks = new GitTerminalLinkProvider()));
+ }
+
+ context.subscriptions.push(
+ configuration.onDidChange(e => {
+ if (!configuration.changed(e, 'terminalLinks', 'enabled')) return;
+
+ this._terminalLinks?.dispose();
+ if (Container.config.terminalLinks.enabled) {
+ context.subscriptions.push((this._terminalLinks = new GitTerminalLinkProvider()));
+ }
+ }),
+ );
+
context.subscriptions.push(new GitFileSystemProvider());
context.subscriptions.push(configuration.onWillChange(this.onConfigurationChanging, this));