Skip to content

Display linked issue(s) from the PR Overview #5824#6835

Open
mohamedamara1 wants to merge 5 commits intomicrosoft:mainfrom
mohamedamara1:feature/5824-v2
Open

Display linked issue(s) from the PR Overview #5824#6835
mohamedamara1 wants to merge 5 commits intomicrosoft:mainfrom
mohamedamara1:feature/5824-v2

Conversation

@mohamedamara1
Copy link
Copy Markdown
Contributor

Replacement of #5825

@mohamedamara1
Copy link
Copy Markdown
Contributor Author

mohamedamara1 commented Apr 26, 2025

the closing issues of a PR are retireved succesfully as props to the sidebar component, what's missing is

  • listing them down in the UI
  • improvements on the selected fields

@mohamedamara1 mohamedamara1 marked this pull request as draft April 26, 2025 23:32
@mohamedamara1 mohamedamara1 marked this pull request as ready for review April 26, 2025 23:33
Comment thread src/github/graphql.ts
@mohamedamara1
Copy link
Copy Markdown
Contributor Author

any comments on this so far ? @alexr00
I know that I still need to fix the UI a bit (icons)

@alexr00 alexr00 added this to the May 2025 milestone Apr 30, 2025
@alexr00
Copy link
Copy Markdown
Member

alexr00 commented Apr 30, 2025

I'll try to take a look on Friday. We're doing our release prep week now (endgame).

Copy link
Copy Markdown
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

image

Comment thread src/github/interface.ts Outdated
Comment thread webviews/components/sidebar.tsx Outdated
<div className="section-title">Linked Issues</div>
</div>
{closingIssues.length > 0 ? (
<div className="p-2">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a class name that is consistent with the class naming scheme in the file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for gap-2 below.

Comment thread src/github/views.ts Outdated
lastReviewType?: ReviewType;
revertable?: boolean;
busy?: boolean;
closingIssues: Pick<Issue, 'title' | 'number' | 'state'>[];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pick<Issue, 'title' | 'number' | 'state'> is used in more than one place, can you refactor it into an IssueReference type in this file?

Comment thread webviews/components/sidebar.tsx Outdated

switch (normalizedState) {
case 'open':
return settingsIcon;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not issueIcon?

@mohamedamara1
Copy link
Copy Markdown
Contributor Author

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

mohamedamara1 and others added 2 commits April 22, 2026 14:07
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.
mohamedamara1 added a commit to mohamedamara1/vscode-pull-request-github that referenced this pull request Apr 22, 2026
- 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>
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.
@mohamedamara1 mohamedamara1 requested a review from alexr00 April 22, 2026 15:41
return (
<div className="avatar-with-author">
<span className={`section-icon ${isOpen ? 'issue-open' : 'issue-closed'}`}>
{isOpen ? issueIcon : issueClosedIcon}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it currently looks like:
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, when it's clicked it should open the issue webview, rather than issue in your browser.

Comment thread src/github/queries.gql
mergeCommitMessage
mergeCommitTitle
}
closingIssuesReferences(first: 50) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')} />;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add another export here, pass is already exported above.

)}
</Section>

<Section
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a weird class to use here, as there's no avatar with author in the div.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants