Skip to content

Commit a3558a9

Browse files
committed
Ensures stats for Commit/Stash tooltips
Fixes tooltip stats colorization
1 parent c5fb843 commit a3558a9

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@
16241624
},
16251625
"gitlens.views.formats.stashes.tooltip": {
16261626
"type": "string",
1627-
"default": "${link}${' on `'stashOnRef`}${'  'changesDetail} \\\n  $(history) ${ago} _(${date})_ ${message}${\n\n---\n\nfootnotes}",
1627+
"default": "${link}${' on `'stashOnRef`}${'\\\n  'changesDetail} \\\n  $(history) ${ago} _(${date})_ ${message}${\n\n---\n\nfootnotes}",
16281628
"markdownDescription": "Specifies the tooltip format (in markdown) of stashes in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs",
16291629
"scope": "window",
16301630
"order": 52

src/git/models/commit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ export class GitCommit implements GitRevisionReference {
435435
const additionsText = pluralize('addition', additions);
436436
if (options?.color) {
437437
lineStats.push(
438-
/*html*/ `<span style="color:var(--vscode-gitDecoration-addedResourceForeground)">${additionsText}</span>`,
438+
/*html*/ `<span style="color:var(--vscode-gitDecoration-addedResourceForeground);">${additionsText}</span>`,
439439
);
440440
} else {
441441
lineStats.push(additionsText);
@@ -446,7 +446,7 @@ export class GitCommit implements GitRevisionReference {
446446
const deletionsText = pluralize('deletion', deletions);
447447
if (options?.color) {
448448
lineStats.push(
449-
/*html*/ `<span style="color:var(--vscode-gitDecoration-deletedResourceForeground)">${deletionsText}</span>`,
449+
/*html*/ `<span style="color:var(--vscode-gitDecoration-deletedResourceForeground);">${deletionsText}</span>`,
450450
);
451451
} else {
452452
lineStats.push(deletionsText);

src/plus/webviews/graph/graphWebview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
11491149
private async getCommitTooltip(commit: GitCommit, cancellation: CancellationToken) {
11501150
const [remotesResult, _] = await Promise.allSettled([
11511151
this.container.git.getBestRemotesWithProviders(commit.repoPath),
1152-
commit.ensureFullDetails(),
1152+
commit.ensureFullDetails({ include: { stats: true } }),
11531153
]);
11541154

11551155
if (cancellation.isCancellationRequested) throw new CancellationError();

src/views/nodes/abstract/viewFileNode.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,8 @@ export function getFileTooltip(
5050
}
5151

5252
export function getFileTooltipMarkdown(file: GitFile | GitStatusFile, suffix?: string) {
53-
return new MarkdownString(getFileTooltip(file, suffix, 'markdown'), true);
53+
const tooltip = new MarkdownString(getFileTooltip(file, suffix, 'markdown'), true);
54+
tooltip.supportHtml = true;
55+
tooltip.isTrusted = true;
56+
return tooltip;
5457
}

src/views/nodes/commitNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export class CommitNode extends ViewRefNode<'commit', ViewsWithCommits | FileHis
254254
private async getTooltip(cancellation: CancellationToken) {
255255
const [remotesResult, _] = await Promise.allSettled([
256256
this.view.container.git.getBestRemotesWithProviders(this.commit.repoPath, cancellation),
257-
this.commit.message == null ? this.commit.ensureFullDetails() : undefined,
257+
this.commit.ensureFullDetails({ include: { stats: true } }),
258258
]);
259259

260260
if (cancellation.isCancellationRequested) return undefined;

src/views/nodes/stashNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class StashNode extends ViewRefNode<'stash', ViewsWithStashes, GitStashRe
9393
private async getTooltip(cancellation: CancellationToken) {
9494
const [remotesResult, _] = await Promise.allSettled([
9595
this.view.container.git.getBestRemotesWithProviders(this.commit.repoPath, cancellation),
96-
this.commit.message == null ? this.commit.ensureFullDetails() : undefined,
96+
this.commit.ensureFullDetails({ include: { stats: true } }),
9797
]);
9898

9999
if (cancellation.isCancellationRequested) return undefined;

0 commit comments

Comments
 (0)