Pārlūkot izejas kodu

Fixes issue with status bar hover

Removes bad test code & improves cancellation
main
Eric Amodio pirms 2 gadiem
vecāks
revīzija
01d96eefee
2 mainītis faili ar 9 papildinājumiem un 4 dzēšanām
  1. +7
    -2
      src/hovers/hovers.ts
  2. +2
    -2
      src/statusbar/statusBarController.ts

+ 7
- 2
src/hovers/hovers.ts Parādīt failu

@ -1,5 +1,5 @@
'use strict';
import { MarkdownString } from 'vscode';
import { CancellationToken, MarkdownString } from 'vscode';
import { DiffWithCommand, ShowQuickCommitCommand } from '../commands';
import { GlyphChars } from '../constants';
import { Container } from '../container';
@ -189,6 +189,7 @@ export namespace Hovers {
dateFormat: string | null,
options?: {
autolinks?: boolean;
cancellationToken?: CancellationToken;
pullRequests?: {
enabled: boolean;
pr?: PullRequest | Promises.CancellationError<Promise<PullRequest | undefined>>;
@ -205,6 +206,8 @@ export namespace Hovers {
const remotes = await Container.instance.git.getRemotes(commit.repoPath, { sort: true });
if (options?.cancellationToken?.isCancellationRequested) return new MarkdownString();
const [previousLineDiffUris, autolinkedIssuesOrPullRequests, pr, presence] = await Promise.all([
commit.isUncommitted ? commit.getPreviousLineDiffUris(uri, editorLine, uri.sha) : undefined,
getAutoLinkedIssuesOrPullRequests(commit.message, remotes),
@ -224,6 +227,8 @@ export namespace Hovers {
Container.instance.vsls.maybeGetPresence(commit.email),
]);
if (options?.cancellationToken?.isCancellationRequested) return new MarkdownString();
const details = await CommitFormatter.fromTemplateAsync(format, commit, {
autolinkedIssuesOrPullRequests: autolinkedIssuesOrPullRequests,
dateFormat: dateFormat,
@ -261,7 +266,7 @@ export namespace Hovers {
}
async function getAutoLinkedIssuesOrPullRequests(message: string, remotes: GitRemote[]) {
const cc = Logger.getNewCorrelationContext('Hovers.getAutoLinkedIssues');
const cc = Logger.getNewCorrelationContext('Hovers.getAutoLinkedIssuesOrPullRequests');
Logger.debug(cc, `${GlyphChars.Dash} message=<message>`);
const start = hrtime();

+ 2
- 2
src/statusbar/statusBarController.ts Parādīt failu

@ -18,7 +18,7 @@ import { Container } from '../container';
import { CommitFormatter, GitBlameCommit, PullRequest } from '../git/git';
import { Hovers } from '../hovers/hovers';
import { LogCorrelationContext, Logger } from '../logger';
import { debug, Functions, Promises } from '../system';
import { debug, Promises } from '../system';
import { LinesChangeEvent } from '../trackers/gitLineTracker';
export class StatusBarController implements Disposable {
@ -359,7 +359,6 @@ export class StatusBarController implements Disposable {
) {
if (cancellationToken.isCancellationRequested) return;
void (await Functions.wait(10000));
const tooltip = await Hovers.detailsMessage(
commit,
commit.toGitUri(),
@ -368,6 +367,7 @@ export class StatusBarController implements Disposable {
this.container.config.defaultDateFormat,
{
autolinks: true,
cancellationToken: cancellationToken,
getBranchAndTagTips: getBranchAndTagTips,
pullRequests: pullRequests,
},

Notiek ielāde…
Atcelt
Saglabāt