Skip to content

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

Merged
alexr00 merged 6 commits intomicrosoft:mainfrom
mohamedamara1:feature/5824-v2
Apr 29, 2026
Merged

Display linked issue(s) from the PR Overview #5824#6835
alexr00 merged 6 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
Comment thread src/github/views.ts Outdated
Comment thread webviews/components/sidebar.tsx Outdated
@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
Comment thread webviews/components/sidebar.tsx Outdated
Comment thread webviews/components/sidebar.tsx Outdated
Comment thread src/github/queries.gql
Comment thread webviews/components/icon.tsx Outdated
Comment thread webviews/components/sidebar.tsx Outdated
Comment thread webviews/components/sidebar.tsx Outdated
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.

@mohamedamara1 I find myself really needing this these days as Copilot created PRs link the issue to the PR, but don't mention the issue number in the PR description. I'm going to address my own comments. Thank you for pushing for this!

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 12:44
@alexr00 alexr00 enabled auto-merge (squash) April 29, 2026 12:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for showing “Linked Issues” (issues the PR will close) in the PR Overview webview sidebar by fetching closingIssuesReferences from GitHub GraphQL, parsing it into the model/view payload, and rendering a new sidebar section.

Changes:

  • Extend PR GraphQL fragments/types + parsing to include closingIssuesReferences.
  • Plumb closingIssues through PullRequestModel → PR overview webview initialization (with issue links converted to “open issue webview” URIs).
  • Render a new “Linked Issues” sidebar section and add CSS styling.
Show a summary per file
File Description
webviews/editorWebview/test/builder/pullRequest.ts Adds closingIssues default to the PR test builder.
webviews/components/sidebar.tsx Renders a new “Linked Issues” section in the sidebar.
webviews/common/common.css Adds styles for linked issue rows + open/closed issue icon coloring.
src/github/views.ts Adds IssueReference and closingIssues to the webview PR shape.
src/github/utils.ts Parses closingIssuesReferences nodes into closingIssues on the internal PR model.
src/github/queriesLimited.gql Adds closingIssuesReferences fields to the limited PR fragment.
src/github/queriesExtra.gql Adds closingIssuesReferences fields to the extra PR fragment.
src/github/queries.gql Adds closingIssuesReferences fields to the main PR fragment.
src/github/pullRequestOverview.ts Transforms linked issue URLs into issue-webview URIs and includes them in pr.initialize.
src/github/pullRequestModel.ts Stores closingIssues on the PR model and populates it from parsed item data.
src/github/interface.ts Introduces internal IssueReference and adds closingIssues to internal PR type.
src/github/graphql.ts Extends the GraphQL PR type with closingIssuesReferences.

Copilot's findings

Comments suppressed due to low confidence (1)

webviews/components/sidebar.tsx:280

  • React keying closingIssues items by issue.number can collide when linked issues span multiple repositories (e.g. owner1/repo1#123 and owner2/repo2#123). Use a stable unique key (e.g. issue.url or an explicit id/owner+repo+number field) to avoid incorrect item reuse during re-renders.
					{closingIssues.map(issue => (
						<IssueItem key={issue.number} issue={issue} />
					))}
  • Files reviewed: 12/12 changed files
  • Comments generated: 10

Comment thread src/github/utils.ts
Comment on lines 924 to 928
commentCount: graphQLPullRequest.comments.totalCount,
additions: graphQLPullRequest.additions,
deletions: graphQLPullRequest.deletions,
closingIssues: parseClosingIssuesReferences(graphQLPullRequest.closingIssuesReferences?.nodes),
};
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

New closingIssues parsing/mapping is untested. Since parseGraphQLPullRequest already has unit coverage under src/test (e.g. prsTree.test.ts), consider adding a case that includes closingIssuesReferences to verify state mapping and that the parsed references are propagated correctly.

Copilot generated this review using guidance from repository custom instructions.
Comment thread webviews/components/sidebar.tsx
Comment thread src/github/graphql.ts
Comment thread src/github/queriesExtra.gql
Comment thread src/github/queries.gql
Comment thread src/github/pullRequestOverview.ts
Comment thread src/github/queriesLimited.gql
Comment thread src/github/utils.ts
Comment thread src/github/views.ts
Comment thread src/github/interface.ts
@alexr00
Copy link
Copy Markdown
Member

alexr00 commented Apr 29, 2026

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@alexr00 alexr00 merged commit c9ecbbe into microsoft:main Apr 29, 2026
7 checks passed
@alexr00 alexr00 modified the milestones: May 2025, 1.119.0 Apr 29, 2026
@mohamedamara1
Copy link
Copy Markdown
Contributor Author

@mohamedamara1 I find myself really needing this these days as Copilot created PRs link the issue to the PR, but don't mention the issue number in the PR description. I'm going to address my own comments. Thank you for pushing for this!

Great, thanks

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.

5 participants