Display linked issue(s) from the PR Overview #5824#6835
Display linked issue(s) from the PR Overview #5824#6835mohamedamara1 wants to merge 5 commits intomicrosoft:mainfrom
Conversation
|
the closing issues of a PR are retireved succesfully as props to the sidebar component, what's missing is
|
|
any comments on this so far ? @alexr00 |
|
I'll try to take a look on Friday. We're doing our release prep week now (endgame). |
There was a problem hiding this comment.
Thanks for the PR @mohamedamara1! I made a few small changes, and I have a few comments, as well as feedback on the UI itself:
| <div className="section-title">Linked Issues</div> | ||
| </div> | ||
| {closingIssues.length > 0 ? ( | ||
| <div className="p-2"> |
There was a problem hiding this comment.
Please use a class name that is consistent with the class naming scheme in the file.
| lastReviewType?: ReviewType; | ||
| revertable?: boolean; | ||
| busy?: boolean; | ||
| closingIssues: Pick<Issue, 'title' | 'number' | 'state'>[]; |
There was a problem hiding this comment.
Pick<Issue, 'title' | 'number' | 'state'> is used in more than one place, can you refactor it into an IssueReference type in this file?
|
|
||
| switch (normalizedState) { | ||
| case 'open': | ||
| return settingsIcon; |
|
hello @alexr00, it's been a while but I'm picking this up, converting it to draft first and when it's ready for review I will let you know |
Adds a "Linked Issues" section to the PR Overview sidebar that lists the issues a PR closes, using the GraphQL `closingIssuesReferences` field. The section is read-only since GitHub's API does not expose a mutation for linking/unlinking issues. Squashed and rebased onto current main; drops the now-redundant `parsePullRequestState` helper since main has independently introduced `stateToStateEnum` for the same dedup, and replaces it with an inline OPEN/CLOSED mapping in `parseClosingIssuesReferences`. Co-Authored-By: Alex Ross <38270282+alexr00@users.noreply.github.com>
- Extract IssueReference type into views.ts and use it for closingIssues (alexr00 review feedback). - Sidebar: drop orphan tailwind-style class names (p-2, gap-2, p-4, text-sm, text-gray-500, text-center, h2) that are not defined in the project's CSS — replace with the project's section conventions. - Use the existing issueIcon / issueClosedIcon for the issue state icon instead of settingsIcon / closeIcon. - Switch on GithubItemStateEnum directly rather than lowercasing strings. - Move the React `key` to the iterating element and key by issue.number (titles are not guaranteed unique). - Render the issue number alongside the title. - Initialize PullRequestModel.closingIssues to [] so the field is never undefined when serialized to the webview.
6feea6a to
3050d45
Compare
- Extract IssueReference type into views.ts and use it for closingIssues (alexr00 review feedback). - Sidebar: drop orphan tailwind-style class names (p-2, gap-2, p-4, text-sm, text-gray-500, text-center, h2) that are not defined in the project's CSS — replace with the project's section conventions. - Use the existing issueIcon / issueClosedIcon for the issue state icon instead of settingsIcon / closeIcon. - Switch on GithubItemStateEnum directly rather than lowercasing strings. - Move the React `key` to the iterating element and key by issue.number (titles are not guaranteed unique). - Render the issue number alongside the title. - Initialize PullRequestModel.closingIssues to [] so the field is never undefined when serialized to the webview. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3050d45 to
d817cc8
Compare
The previous commit imported these from './icon' but they were removed from icon.tsx during the codicon refactor on main. Restore them as named exports — issueIcon uses the existing issue_webview.svg, issueClosedIcon uses the pass codicon (checkmark in circle).
Adds the issue url to the GraphQL query and through the IssueReference type, then wraps the issue label in an <a href> in the sidebar. VS Code's webview intercepts the click and opens the URL via openExternal, matching the behavior of AuthorLink in the same view.
Wraps the issue state icon in a .section-icon span and adds two new state classes (.issue-open, .issue-closed) coloured with the existing --vscode-issues-open and --vscode-issues-closed tokens that this extension contributes. Matches the colouring convention already used for reviewer state icons (.section-icon.approved). The .section-icon container also provides flex centering and 3px padding, which fixes the icon-vs-link spacing in the row.
| return ( | ||
| <div className="avatar-with-author"> | ||
| <span className={`section-icon ${isOpen ? 'issue-open' : 'issue-closed'}`}> | ||
| {isOpen ? issueIcon : issueClosedIcon} |
There was a problem hiding this comment.
Should use issuescon (looks like there's a typo in the icon variable, but that's the correct icon) instead of issueIcon.
| <span className={`section-icon ${isOpen ? 'issue-open' : 'issue-closed'}`}> | ||
| {isOpen ? issueIcon : issueClosedIcon} | ||
| </span> | ||
| <a href={issue.url} title={issue.url}>#{issue.number} {issue.title}</a> |
There was a problem hiding this comment.
Can the styling of this be improved?
- not blue
- overflow shouldn't wrap to the next line, and instead end with ...
- would also be nice to use the same colors as GH for the icon.
There was a problem hiding this comment.
Also, when it's clicked it should open the issue webview, rather than issue in your browser.
| mergeCommitMessage | ||
| mergeCommitTitle | ||
| } | ||
| closingIssuesReferences(first: 50) { |
There was a problem hiding this comment.
Also needs to be added in queriesExtra.gql and queriesLimited.gql.
|
|
||
| // Other icons | ||
| export const issueIcon = <Icon src={require('../../resources/icons/issue_webview.svg')} />; | ||
| export const issueClosedIcon = <Icon src={require('../../resources/icons/codicons/pass.svg')} />; |
There was a problem hiding this comment.
No need to add another export here, pass is already exported above.
| )} | ||
| </Section> | ||
|
|
||
| <Section |
There was a problem hiding this comment.
If there are no closing issues, let's just not show this section. It's not actionable when there's nothing in it.
| function IssueItem({ issue }: { issue: IssueReference }) { | ||
| const isOpen = issue.state === GithubItemStateEnum.Open; | ||
| return ( | ||
| <div className="avatar-with-author"> |
There was a problem hiding this comment.
This seems like a weird class to use here, as there's no avatar with author in the div.


Replacement of #5825