Просмотр исходного кода

Adds refresh hover command for PRs

main
Eric Amodio 4 лет назад
Родитель
Сommit
b7c3ff30e3
4 измененных файлов: 21 добавлений и 3 удалений
  1. +1
    -0
      src/commands.ts
  2. +1
    -0
      src/commands/common.ts
  3. +15
    -0
      src/commands/refreshHover.ts
  4. +4
    -3
      src/git/formatters/commitFormatter.ts

+ 1
- 0
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';

+ 1
- 0
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',

+ 15
- 0
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');
}
}

+ 4
- 3
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);

Загрузка…
Отмена
Сохранить