diff --git a/CHANGELOG.md b/CHANGELOG.md index c91d823..f672e14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] +### Added + +- Adds a Terminal Links section to the GitLens Interactive Settings + ### Changed - Improved Rebase editor — better performance and user experience @@ -17,6 +21,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Adds emoji support for commit messages — closes [#1789](https://github.com/gitkraken/vscode-gitlens/issues/1789) - Ensures that large rebases show rich commit details - Changes the _Home_ view to always be available +- Changes SHA terminal links to use the _Commit Details_ view — closes [#2320](https://github.com/gitkraken/vscode-gitlens/issues/2320) + - Adds a `gitlens.terminalLinks.showDetailsView` setting to specify whether to show the _Commit Details_ view when clicking on a commit link ### Fixed @@ -45,9 +51,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Adds a banner to the _Commit Details_ view to let users know they can move the view to the Secondary Side Bar -### Updated +### Changed -- Updates the _Commit Graph_ settings clarity and ordering +- Changes the _Commit Graph_ settings for improved clarity and ordering ### Fixed diff --git a/package.json b/package.json index 3edc760..4c34e0a 100644 --- a/package.json +++ b/package.json @@ -2683,7 +2683,15 @@ "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" + "scope": "window", + "order": 10 + }, + "gitlens.terminalLinks.showDetailsView": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether to show the _Commit Details_ view when clicking on a commit link in the integrated terminal", + "scope": "window", + "order": 20 } } }, diff --git a/src/config.ts b/src/config.ts index 95e06e5..b509885 100644 --- a/src/config.ts +++ b/src/config.ts @@ -156,6 +156,7 @@ export interface Config { }; terminalLinks: { enabled: boolean; + showDetailsView: boolean; }; views: ViewsConfig; virtualRepositories: { diff --git a/src/terminal/linkProvider.ts b/src/terminal/linkProvider.ts index 3059a25..f1d1960 100644 --- a/src/terminal/linkProvider.ts +++ b/src/terminal/linkProvider.ts @@ -2,20 +2,23 @@ import type { Disposable, TerminalLink, TerminalLinkContext, TerminalLinkProvide import { commands, window } from 'vscode'; import type { GitCommandsCommandArgs, + ShowCommitsInViewCommandArgs, ShowQuickBranchHistoryCommandArgs, ShowQuickCommitCommandArgs, } from '../commands'; +import { configuration } from '../configuration'; import { Commands } from '../constants'; import type { Container } from '../container'; import type { PagedResult } from '../git/gitProvider'; import type { GitBranch } from '../git/models/branch'; +import { getBranchNameWithoutRemote } from '../git/models/branch'; import { GitReference } from '../git/models/reference'; import type { GitTag } from '../git/models/tag'; const commandsRegexShared = /\b(g(?:it)?\b\s*)\b(branch|checkout|cherry-pick|fetch|grep|log|merge|pull|push|rebase|reset|revert|show|stash|status|tag)\b/gi; // Since negative lookbehind isn't supported in all browsers, leave out the negative lookbehind condition `(? | undefined; @@ -100,7 +105,10 @@ export class GitTerminalLinkProvider implements Disposable, TerminalLinkProvider // TODO@eamodio handle paging } - const branch = branchResults.values.find(r => r.name === ref); + let branch = branchResults.values.find(r => r.name === ref); + if (branch == null) { + branch = branchResults.values.find(r => getBranchNameWithoutRemote(r.name) === ref); + } if (branch != null) { const link: GitTerminalLink = { startIndex: match.index, @@ -161,17 +169,25 @@ export class GitTerminalLinkProvider implements Disposable, TerminalLinkProvider } if (await this.container.git.validateReference(repoPath, ref)) { - const link: GitTerminalLink = { + const link: GitTerminalLink = { startIndex: match.index, length: ref.length, tooltip: 'Show Commit', - command: { - command: Commands.ShowQuickCommit, - args: { - repoPath: repoPath, - sha: ref, - }, - }, + command: showDetailsView + ? { + command: Commands.ShowInDetailsView, + args: { + repoPath: repoPath, + refs: [ref], + }, + } + : { + command: Commands.ShowQuickCommit, + args: { + repoPath: repoPath, + sha: ref, + }, + }, }; links.push(link); } diff --git a/src/webviews/apps/settings/partials/terminal-links.html b/src/webviews/apps/settings/partials/terminal-links.html new file mode 100644 index 0000000..bd86bfd --- /dev/null +++ b/src/webviews/apps/settings/partials/terminal-links.html @@ -0,0 +1,40 @@ + diff --git a/src/webviews/apps/settings/settings.html b/src/webviews/apps/settings/settings.html index 050c2d7..03c5c12 100644 --- a/src/webviews/apps/settings/settings.html +++ b/src/webviews/apps/settings/settings.html @@ -85,6 +85,7 @@ <%= require('html-loader?{"esModule":false}!./partials/commit-graph.html') %> <%= require('html-loader?{"esModule":false}!./partials/rebase-editor.html') %> <%= require('html-loader?{"esModule":false}!./partials/autolinks.html') %> + <%= require('html-loader?{"esModule":false}!./partials/terminal-links.html') %> <%= require('html-loader?{"esModule":false}!./partials/dates.html') %> <%= require('html-loader?{"esModule":false}!./partials/menus.html') %> <%= require('html-loader?{"esModule":false}!./partials/shortcuts.html') %> @@ -306,6 +307,16 @@ Terminal Links + + +
  • + Dates & Times