From f4de2a502b072539992aa8238612b225b0c14492 Mon Sep 17 00:00:00 2001 From: Eshwar Prithvi Jonnadula Date: Thu, 12 Mar 2026 01:00:52 +0530 Subject: [PATCH] initial push --- package.json | 8 ++++++-- package.nls.json | 2 ++ src/github/interface.ts | 1 + src/issues/issuesView.ts | 40 +++++++++++++++++++++++++++++++------- src/issues/stateManager.ts | 2 +- 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 868cb5177c..96cd179e4a 100644 --- a/package.json +++ b/package.json @@ -763,11 +763,15 @@ "type": "string", "enum": [ "repository", - "milestone" + "milestone", + "issueType", + "labels" ], "enumDescriptions": [ + "%githubIssues.queries.groupBy.repository%", "%githubIssues.queries.groupBy.milestone%", - "%githubIssues.queries.groupBy.repository%" + "%githubIssues.queries.groupBy.issueType%", + "%githubIssues.queries.groupBy.labels%" ] } } diff --git a/package.nls.json b/package.nls.json index a80448dad9..2d7f392e76 100644 --- a/package.nls.json +++ b/package.nls.json @@ -168,6 +168,8 @@ "githubIssues.queries.groupBy": "The categories to group issues by when displaying them, in the order in which they should be grouped.", "githubIssues.queries.groupBy.repository": "Group issues by their repository.", "githubIssues.queries.groupBy.milestone": "Group issues by their milestone.", + "githubIssues.queries.groupBy.issueType": "Group issues by their GitHub issue type (Bug, Feature, Task, etc.).", + "githubIssues.queries.groupBy.labels": "Group issues by their labels (issues can appear in multiple groups).", "githubIssues.queries.default.myIssues": "My Issues", "githubIssues.queries.default.createdIssues": "Created Issues", "githubIssues.queries.default.recentIssues": "Recent Issues", diff --git a/src/github/interface.ts b/src/github/interface.ts index 4bf23999c5..c10a2c5870 100644 --- a/src/github/interface.ts +++ b/src/github/interface.ts @@ -221,6 +221,7 @@ export interface Issue { commentCount: number; reactionCount: number; reactions: Reaction[]; + issueType?: string; } export interface PullRequest extends Issue { diff --git a/src/issues/issuesView.ts b/src/issues/issuesView.ts index f43a04f15a..2246828514 100644 --- a/src/issues/issuesView.ts +++ b/src/issues/issuesView.ts @@ -243,17 +243,42 @@ export class IssuesTreeData return issues; } const groupByValue = groupByOrder[indexInGroupByOrder]; - if ((groupByValue !== 'milestone' && groupByValue !== 'repository') || groupByOrder.findIndex(groupBy => groupBy === groupByValue) !== indexInGroupByOrder) { + if ((groupByValue !== 'milestone' && groupByValue !== 'repository' && groupByValue !== 'issueType' && groupByValue !== 'labels') || groupByOrder.findIndex(groupBy => groupBy === groupByValue) !== indexInGroupByOrder) { return this.getIssueGroupsForGroupIndex(repoRootUri, queryLabel, isFirst, groupByOrder, indexInGroupByOrder + 1, issues); } - const groups = groupBy(issues, issue => { - if (groupByValue === 'repository') { - return `${issue.remote.owner}/${issue.remote.repositoryName}`; - } else { - return issue.milestone?.title ?? 'No Milestone'; + const groups: { [key: string]: IssueItem[] } = {}; + + if (groupByValue === 'labels') { + // For labels, an issue can appear in multiple groups if it has multiple labels + for (const issue of issues) { + const issueLabels = issue.item.labels && issue.item.labels.length > 0 + ? issue.item.labels.map(l => l.name) + : ['No Labels']; + for (const label of issueLabels) { + if (!groups[label]) { + groups[label] = []; + } + groups[label].push(issue); + } } - }); + } else if (groupByValue === 'issueType') { + // Group by GitHub's native issue type (Bug, Feature, Task, etc.) + const groupsTemp = groupBy(issues, issue => { + return issue.item.issueType ?? 'No Issue Type'; + }); + Object.assign(groups, groupsTemp); + } else { + const groupsTemp = groupBy(issues, issue => { + if (groupByValue === 'repository') { + return `${issue.remote.owner}/${issue.remote.repositoryName}`; + } else if (groupByValue === 'milestone') { + return issue.milestone?.title ?? 'No Milestone'; + } + return 'Other'; + }); + Object.assign(groups, groupsTemp); + } const nodes: IssueGroupNode[] = []; for (const group in groups) { nodes.push(new IssueGroupNode(repoRootUri, queryLabel, isFirst, indexInGroupByOrder, group, groupByOrder, groups[group])); @@ -261,6 +286,7 @@ export class IssuesTreeData return nodes; } + private async getIssueGroupChildren(issueGroupNode: IssueGroupNode): Promise { return this.getIssueGroupsForGroupIndex(issueGroupNode.repoRootUri, issueGroupNode.queryLabel, issueGroupNode.isInFirstQuery, issueGroupNode.groupByOrder, issueGroupNode.groupLevel + 1, issueGroupNode.issuesInGroup); } diff --git a/src/issues/stateManager.ts b/src/issues/stateManager.ts index 14316c0818..cebc86e841 100644 --- a/src/issues/stateManager.ts +++ b/src/issues/stateManager.ts @@ -64,7 +64,7 @@ interface SingleRepoState { folderManager: FolderRepositoryManager; } -export type QueryGroup = 'repository' | 'milestone'; +export type QueryGroup = 'repository' | 'milestone' | 'issueType' | 'labels'; export interface IssueQueryResult { groupBy: QueryGroup[];