diff --git a/package.json b/package.json index cde0edd92f..92ea5d5238 100644 --- a/package.json +++ b/package.json @@ -824,6 +824,11 @@ "default": "author", "description": "%githubIssues.issueAvatarDisplay.description%" }, + "githubIssues.showIssueNumberInTree": { + "type": "boolean", + "default": false, + "description": "%githubIssues.showIssueNumberInTree.description%" + }, "githubPullRequests.focusedMode": { "properties": { "oneOf": [ diff --git a/package.nls.json b/package.nls.json index ea64843094..3d0f267039 100644 --- a/package.nls.json +++ b/package.nls.json @@ -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.", diff --git a/src/common/settingKeys.ts b/src/common/settingKeys.ts index 0f5e64399b..a4bdae5352 100644 --- a/src/common/settingKeys.ts +++ b/src/common/settingKeys.ts @@ -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'; diff --git a/src/issues/issuesView.ts b/src/issues/issuesView.ts index f43a04f15a..9628ad7ea8 100644 --- a/src/issues/issuesView.ts +++ b/src/issues/issuesView.ts @@ -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'; @@ -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(); } }), @@ -87,7 +88,11 @@ export class IssuesTreeData } private async getIssueTreeItem(element: IssueItem): Promise { - const treeItem = new vscode.TreeItem(element.title, vscode.TreeItemCollapsibleState.None); + const showIssueNumber = vscode.workspace + .getConfiguration(ISSUES_SETTINGS_NAMESPACE, null) + .get(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) @@ -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';