Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,11 @@
"default": "author",
"description": "%githubIssues.issueAvatarDisplay.description%"
},
"githubIssues.showIssueNumberInTree": {
"type": "boolean",
"default": false,
"description": "%githubIssues.showIssueNumberInTree.description%"
},
"githubPullRequests.focusedMode": {
"properties": {
"oneOf": [
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
"githubIssues.issueAvatarDisplay.description": "Controls which avatar to display in the issue list.",
"githubIssues.issueAvatarDisplay.author": "Show the avatar of the issue creator.",
"githubIssues.issueAvatarDisplay.assignee": "Show the avatar of the first assignee (show GitHub icon if no assignees).",
"githubIssues.showIssueNumberInTree.description": "Shows the issue number in the tree view.",
"githubPullRequests.focusedMode.description": "The layout to use when a pull request is checked out. Set to false to prevent layout changes.",
"githubPullRequests.focusedMode.firstDiff": "Show the first diff in the pull request. If there are no changes, show the overview.",
"githubPullRequests.focusedMode.overview": "Show the overview of the pull request.",
Expand Down
1 change: 1 addition & 0 deletions src/common/settingKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const IGNORE_MILESTONES = 'ignoreMilestones';
export const ALLOW_FETCH = 'allowFetch';
export const ALWAYS_PROMPT_FOR_NEW_ISSUE_REPO = 'alwaysPromptForNewIssueRepo';
export const ISSUE_AVATAR_DISPLAY = 'issueAvatarDisplay';
export const SHOW_ISSUE_NUMBER_IN_TREE = 'showIssueNumberInTree';
export const EXPERIMENTAL_CHAT = 'experimental.chat';
export const EXPERIMENTAL_USE_QUICK_CHAT = 'experimental.useQuickChat';
export const EXPERIMENTAL_NOTIFICATIONS_PAGE_SIZE = 'experimental.notificationsViewPageSize';
Expand Down
13 changes: 9 additions & 4 deletions src/issues/issuesView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as vscode from 'vscode';
import { issueBodyHasLink } from './issueLinkLookup';
import { IssueItem, QueryGroup, StateManager } from './stateManager';
import { commands, contexts } from '../common/executeCommands';
import { ISSUE_AVATAR_DISPLAY, IssueAvatarDisplay, ISSUES_SETTINGS_NAMESPACE } from '../common/settingKeys';
import { ISSUE_AVATAR_DISPLAY, IssueAvatarDisplay, ISSUES_SETTINGS_NAMESPACE, SHOW_ISSUE_NUMBER_IN_TREE } from '../common/settingKeys';
import { DataUri } from '../common/uri';
import { groupBy } from '../common/utils';
import { FolderRepositoryManager, ReposManagerState } from '../github/folderRepositoryManager';
Expand Down Expand Up @@ -65,7 +65,8 @@ export class IssuesTreeData
// Listen for changes to the avatar display setting
context.subscriptions.push(
vscode.workspace.onDidChangeConfiguration(change => {
if (change.affectsConfiguration(`${ISSUES_SETTINGS_NAMESPACE}.${ISSUE_AVATAR_DISPLAY}`)) {
if (change.affectsConfiguration(`${ISSUES_SETTINGS_NAMESPACE}.${ISSUE_AVATAR_DISPLAY}`)
|| change.affectsConfiguration(`${ISSUES_SETTINGS_NAMESPACE}.${SHOW_ISSUE_NUMBER_IN_TREE}`)) {
this._onDidChangeTreeData.fire();
}
}),
Expand All @@ -87,7 +88,11 @@ export class IssuesTreeData
}

private async getIssueTreeItem(element: IssueItem): Promise<vscode.TreeItem> {
const treeItem = new vscode.TreeItem(element.title, vscode.TreeItemCollapsibleState.None);
const showIssueNumber = vscode.workspace
.getConfiguration(ISSUES_SETTINGS_NAMESPACE, null)
.get<boolean>(SHOW_ISSUE_NUMBER_IN_TREE, false);
const numberPrefix = showIssueNumber ? `#${element.number}: ` : '';
const treeItem = new vscode.TreeItem(`${numberPrefix}${element.title}`, vscode.TreeItemCollapsibleState.None);

const avatarDisplaySetting = vscode.workspace
.getConfiguration(ISSUES_SETTINGS_NAMESPACE, null)
Expand Down Expand Up @@ -133,7 +138,7 @@ export class IssuesTreeData
// Escape any $(...) syntax to avoid rendering issue titles as icons.
const escapedTitle = element.title.replace(/\$\([a-zA-Z0-9~-]+\)/g, '\\$&');
const label: vscode.TreeItemLabel2 = {
label: new vscode.MarkdownString(`$(check) ${escapedTitle}`, true)
label: new vscode.MarkdownString(`$(check) ${numberPrefix}${escapedTitle}`, true)
};
treeItem.label = label as vscode.TreeItemLabel;
treeItem.contextValue = 'currentissue';
Expand Down
29 changes: 27 additions & 2 deletions src/notifications/notificationsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { NotificationsProvider } from './notificationsProvider';
import { commands, contexts } from '../common/executeCommands';
import { Disposable } from '../common/lifecycle';
import Logger from '../common/logger';
import { NOTIFICATION_SETTING, NotificationVariants, PR_SETTINGS_NAMESPACE } from '../common/settingKeys';
import { ISSUES_SETTINGS_NAMESPACE, NOTIFICATION_SETTING, NotificationVariants, PR_SETTINGS_NAMESPACE, SHOW_ISSUE_NUMBER_IN_TREE, SHOW_PULL_REQUEST_NUMBER_IN_TREE } from '../common/settingKeys';
import { EventType, TimelineEvent } from '../common/timelineEvent';
import { toNotificationUri } from '../common/uri';
import { CredentialStore } from '../github/credentials';
Expand Down Expand Up @@ -73,6 +73,10 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
this._startPolling();
}
}
if (e.affectsConfiguration(`${ISSUES_SETTINGS_NAMESPACE}.${SHOW_ISSUE_NUMBER_IN_TREE}`)
|| e.affectsConfiguration(`${PR_SETTINGS_NAMESPACE}.${SHOW_PULL_REQUEST_NUMBER_IN_TREE}`)) {
this._onDidChangeTreeData.fire();
}
}));
this._register(PullRequestOverviewPanel.onVisible(e => {
this.markPrNotificationsAsRead(e);
Expand Down Expand Up @@ -116,7 +120,7 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
}

private _resolveNotificationTreeItem(element: NotificationTreeItem): vscode.TreeItem {
const label = element.notification.subject.title;
const label = this._notificationLabel(element);
const item = new vscode.TreeItem(label, vscode.TreeItemCollapsibleState.None);
const notification = element.notification;
const model = element.model;
Expand Down Expand Up @@ -156,6 +160,27 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
return item;
}

private _notificationLabel(element: NotificationTreeItem): string {
let setting: string | undefined;
let namespace: string | undefined;
if (element.notification.subject.type === NotificationSubjectType.Issue) {
setting = SHOW_ISSUE_NUMBER_IN_TREE;
namespace = ISSUES_SETTINGS_NAMESPACE;
} else if (element.notification.subject.type === NotificationSubjectType.PullRequest) {
setting = SHOW_PULL_REQUEST_NUMBER_IN_TREE;
namespace = PR_SETTINGS_NAMESPACE;
}

if (setting !== undefined && namespace !== undefined) {
const showNumber = vscode.workspace.getConfiguration(namespace).get<boolean>(setting, false);
if (showNumber) {
return `#${element.model.number}: ${element.notification.subject.title}`;
}
}

return element.notification.subject.title;
}

private _resolveLoadMoreNotificationsTreeItem(): vscode.TreeItem {
const item = new vscode.TreeItem(vscode.l10n.t('Load More Notifications...'), vscode.TreeItemCollapsibleState.None);
item.command = {
Expand Down