diff --git a/src/commands.ts b/src/commands.ts index 474ef59..9a0baa5 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -33,6 +33,7 @@ export * from './commands/openPullRequestOnRemote'; export * from './commands/openRepoOnRemote'; export * from './commands/openRevisionFile'; export * from './commands/openWorkingFile'; +export * from './commands/refreshHover'; export * from './commands/remoteProviders'; export * from './commands/repositories'; export * from './commands/resetSuppressedWarnings'; diff --git a/src/commands/common.ts b/src/commands/common.ts index 29f0284..66ff7fb 100644 --- a/src/commands/common.ts +++ b/src/commands/common.ts @@ -83,6 +83,7 @@ export enum Commands { PullRepositories = 'gitlens.pullRepositories', PushRepositories = 'gitlens.pushRepositories', GitCommands = 'gitlens.gitCommands', + RefreshHover = 'gitlens.refreshHover', ResetSuppressedWarnings = 'gitlens.resetSuppressedWarnings', RevealCommitInView = 'gitlens.revealCommitInView', SearchCommits = 'gitlens.showCommitSearch', diff --git a/src/commands/refreshHover.ts b/src/commands/refreshHover.ts new file mode 100644 index 0000000..65e1457 --- /dev/null +++ b/src/commands/refreshHover.ts @@ -0,0 +1,15 @@ +'use strict'; +import { commands } from 'vscode'; +import { command, Command, Commands } from './common'; + +@command() +export class RefreshHoverCommand extends Command { + constructor() { + super(Commands.RefreshHover); + } + + async execute() { + // TODO@eamodio figure out how to really refresh/update a hover + await commands.executeCommand('editor.action.showHover'); + } +} diff --git a/src/git/formatters/commitFormatter.ts b/src/git/formatters/commitFormatter.ts index 29bea78..76366d1 100644 --- a/src/git/formatters/commitFormatter.ts +++ b/src/git/formatters/commitFormatter.ts @@ -1,6 +1,7 @@ 'use strict'; import { getPresenceDataUri } from '../../avatars'; import { + Commands, ConnectRemoteProviderCommand, DiffWithCommand, InviteToLiveShareCommand, @@ -305,7 +306,7 @@ export class CommitFormatter extends Formatter { pr.provider }\n${GlyphChars.Dash.repeat(2)}\n${pr.title}\n${pr.state}, ${pr.formatDateFromNow()}")${separator}`; } else if (pr instanceof Promises.CancellationError) { - commands += `[$(git-pull-request) PR (${GlyphChars.Ellipsis})](# "Searching for a Pull Request (if any) that introduced this commit...")${separator}`; + commands += `[$(git-pull-request) PR (${GlyphChars.Ellipsis})](command:${Commands.RefreshHover} "Searching for a Pull Request (if any) that introduced this commit...")${separator}`; } else if (pr.provider != null) { commands += `[$(plug) Connect to ${pr.provider.name}${ GlyphChars.Ellipsis @@ -471,10 +472,10 @@ export class CommitFormatter extends Formatter { } } else if (pr instanceof Promises.CancellationError) { text = this._options.markdown - ? `[PR ${GlyphChars.Ellipsis}](# "Searching for a Pull Request (if any) that introduced this commit...")` + ? `[PR ${GlyphChars.Ellipsis}](command:${Commands.RefreshHover} "Searching for a Pull Request (if any) that introduced this commit...")` : `PR ${GlyphChars.Ellipsis}`; } else { - return emptyStr; + return this._padOrTruncate(emptyStr, this._options.tokenOptions.pullRequest); } return this._padOrTruncate(text, this._options.tokenOptions.pullRequest);