Skip to content

Commit 7039823

Browse files
committed
Adds favorite indicator to branches
1 parent 5dc2d0a commit 7039823

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/quickpicks/gitQuickPickItems.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export namespace BranchQuickPickItem {
118118
const checked =
119119
options.checked || (options.checked == null && options.current === 'checkmark' && branch.current);
120120
const item: BranchQuickPickItem = {
121-
label: `${Strings.pad('$(git-branch)', 0, 2)}${branch.name}${
121+
label: `${Strings.pad('$(git-branch)', 0, 2)}${branch.starred ? '$(star-full) ' : ''}${branch.name}${
122122
checked ? `${GlyphChars.Space.repeat(2)}$(check)${GlyphChars.Space}` : ''
123123
}`,
124124
description: description,

src/views/nodes/branchNode.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export class BranchNode
225225
async getTreeItem(): Promise<TreeItem> {
226226
this.splatted = false;
227227

228-
let tooltip = `${
228+
let tooltip: string | MarkdownString = `${
229229
this.current ? 'Current branch' : 'Branch'
230230
} $(git-branch) ${this.branch.getNameWithoutRemote()}`;
231231

@@ -330,6 +330,11 @@ export class BranchNode
330330
)})`;
331331
}
332332

333+
tooltip = new MarkdownString(tooltip, true);
334+
if (this.branch.starred) {
335+
tooltip.appendMarkdown('\\\n$(star-full) Favorited');
336+
}
337+
333338
const item = new TreeItem(
334339
`${this.options.showCurrent && this.current ? Strings.pad(GlyphChars.Check, 0, 2) : ''}${this.label}`,
335340
this.options.expanded ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.Collapsed,
@@ -343,7 +348,7 @@ export class BranchNode
343348
item.contextValue = contextValue;
344349
item.description = description;
345350
item.id = this.id;
346-
item.tooltip = new MarkdownString(tooltip, true);
351+
item.tooltip = tooltip;
347352

348353
return item;
349354
}

0 commit comments

Comments
 (0)