Skip to content

Commit 0601261

Browse files
committed
Adds new 'counts' Launchpad indicator label option
- Displays an icon & count of each of the priority groups Avoids unneeded indicator data refreshing on config changes Avoids delay/cancellation potential for after startup loaded data Avoids listening for enable/disable in the indicator as its life-cycle is controlled by the container Adds missing enum descriptions
1 parent 7bcd0a6 commit 0601261

File tree

8 files changed

+209
-118
lines changed

8 files changed

+209
-118
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
88

99
### Added
1010

11+
- Adds a new `counts` option to the `gitlens.launchpad.indicator.label` setting to show the status counts of items which need your attention in the _Launchpad_ status bar indicator
1112
- Adds _Search for Commits within Selection_ command to the editor context menu when there is a selection
1213
- Adds a `gitlens.launchpad.ignoredOrganizations` setting to specify an array of organizations (or users) to ignore in the _Launchpad_
1314

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2994,6 +2994,10 @@
29942994
"default",
29952995
"group"
29962996
],
2997+
"enumDescriptions": [
2998+
"Shows the Launchpad icon",
2999+
"Shows the icon of the highest priority group"
3000+
],
29973001
"default": "default",
29983002
"markdownDescription": "Specifies the style of the _Launchpad_ status bar indicator icon",
29993003
"scope": "window",
@@ -3006,7 +3010,13 @@
30063010
],
30073011
"enum": [
30083012
false,
3009-
"item"
3013+
"item",
3014+
"counts"
3015+
],
3016+
"enumDescriptions": [
3017+
"Hides the label",
3018+
"Shows the highest priority item which needs your attention",
3019+
"Shows the status counts of items which need your attention"
30103020
],
30113021
"default": "item",
30123022
"markdownDescription": "Specifies the display of the _Launchpad_ status bar indicator label",

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export interface Config {
9797
readonly enabled: boolean;
9898
readonly openInEditor: boolean;
9999
readonly icon: 'default' | 'group';
100-
readonly label: false | 'item';
100+
readonly label: false | 'item' | 'counts';
101101
readonly useColors: boolean;
102102
readonly groups: ('mergeable' | 'blocked' | 'needs-review' | 'follow-up')[];
103103
readonly polling: {

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ export type TelemetryEvents = {
13151315
'config.launchpad.indicator.enabled': boolean;
13161316
'config.launchpad.indicator.openInEditor': boolean;
13171317
'config.launchpad.indicator.icon': 'default' | 'group';
1318-
'config.launchpad.indicator.label': false | 'item';
1318+
'config.launchpad.indicator.label': false | 'item' | 'counts';
13191319
'config.launchpad.indicator.useColors': boolean;
13201320
'config.launchpad.indicator.groups': string;
13211321
'config.launchpad.indicator.polling.enabled': boolean;

src/container.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ export class Container {
313313
if (configuration.changed(e, 'launchpad.indicator.enabled')) {
314314
this._focusIndicator?.dispose();
315315
this._focusIndicator = undefined;
316+
317+
this.telemetry.sendEvent('launchpad/indicator/hidden');
318+
316319
if (configuration.get('launchpad.indicator.enabled')) {
317320
this._disposables.push((this._focusIndicator = new FocusIndicator(this, this._focusProvider)));
318321
}

src/plus/focus/focus.ts

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ import type {
5454
} from './focusProvider';
5555
import {
5656
countFocusItemGroups,
57+
focusGroupIconMap,
58+
focusGroupLabelMap,
59+
focusGroups,
5760
getFocusItemIdHash,
5861
groupAndSortFocusItems,
5962
supportedFocusIntegrations,
@@ -73,20 +76,6 @@ const actionGroupMap = new Map<FocusActionCategory, string[]>([
7376
['other', ['Other', `Opened by \${author} \${createdDateRelative}`]],
7477
]);
7578

76-
const groupMap = new Map<FocusGroup, [string, string | undefined]>([
77-
['current-branch', ['Current Branch', 'git-branch']],
78-
['pinned', ['Pinned', 'pinned']],
79-
['mergeable', ['Ready to Merge', 'rocket']],
80-
['blocked', ['Blocked', 'error']], //bracket-error
81-
['follow-up', ['Requires Follow-up', 'report']],
82-
// ['needs-attention', ['Needs Your Attention', 'bell-dot']], //comment-unresolved
83-
['needs-review', ['Needs Your Review', 'comment-unresolved']], // feedback
84-
['waiting-for-review', ['Waiting for Review', 'gitlens-clock']],
85-
['draft', ['Draft', 'git-pull-request-draft']],
86-
['other', ['Other', 'ellipsis']],
87-
['snoozed', ['Snoozed', 'bell-slash']],
88-
]);
89-
9079
export interface FocusItemQuickPickItem extends QuickPickItemOfT<FocusItem> {
9180
group: FocusGroup;
9281
}
@@ -191,7 +180,7 @@ export class FocusCommand extends QuickCommand<State> {
191180
const collapsed = new Map<FocusGroup, boolean>(storedCollapsed.map(g => [g, true]));
192181
if (state.initialGroup != null) {
193182
// set all to true except the initial group
194-
for (const [group] of groupMap) {
183+
for (const group of focusGroups) {
195184
collapsed.set(group, group !== state.initialGroup);
196185
}
197186
}
@@ -343,9 +332,11 @@ export class FocusCommand extends QuickCommand<State> {
343332
items.push(
344333
createQuickPickSeparator(groupItems.length ? groupItems.length.toString() : undefined),
345334
createDirectiveQuickPickItem(Directive.Reload, false, {
346-
label: `$(${context.collapsed.get(ui) ? 'chevron-down' : 'chevron-up'})\u00a0\u00a0$(${
347-
groupMap.get(ui)![1]
348-
})\u00a0\u00a0${groupMap.get(ui)![0]?.toUpperCase()}`, //'\u00a0',
335+
label: `$(${
336+
context.collapsed.get(ui) ? 'chevron-down' : 'chevron-up'
337+
})\u00a0\u00a0${focusGroupIconMap.get(ui)!}\u00a0\u00a0${focusGroupLabelMap
338+
.get(ui)
339+
?.toUpperCase()}`, //'\u00a0',
349340
//detail: groupMap.get(group)?.[0].toUpperCase(),
350341
onDidSelect: () => {
351342
const collapsed = !context.collapsed.get(ui);

0 commit comments

Comments
 (0)