Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Checkout Pull Request by Number Enhancement

This PR improves the "Checkout Pull Request by Number" command to provide a better user experience:

  • Analyze current implementation and understand PR fetching
  • Update command to show PR picker with list of open PRs
  • Allow filtering by number, title, or URL in the picker
  • Update command title in package.json
  • Update localization strings in package.nls.json
  • Sort PRs by number (most recent first)
  • Fix memory leak with event listeners
  • Remove unrelated proposed API changes
  • Fix promise resolution edge cases
  • Use finally block for cleanup
  • Create lightweight GraphQL query for PR numbers only
  • Revert title change per feedback
  • Test the implementation manually
  • Run linter and fix any issues
  • Request code review
  • Run security scan

Security Summary

No security vulnerabilities detected by CodeQL scanner.

Changes Per Feedback

  • Created new PullRequestNumbers GraphQL query that fetches only PR number, title, and author (not full PR data)
  • Added getPullRequestNumbers() method to GitHubRepository class
  • Updated checkout command to use lightweight query instead of getPullRequests()
  • Reverted title change to keep "Checkout Pull Request by Number"
Original prompt

This section details on the original issue you should resolve

<issue_title>Check out pull request by number should show PRs in picker</issue_title>
<issue_description>Testing #3144

I would have expected to see a list of PRs to pick from in the picker.

In fact, I would not even name this feature "...by number" but just "Checkout Pull Request..." and from the picker allow to type anything including the number.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 7 commits December 9, 2025 11:19
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
- Added QuickPick to show all open PRs when checking out
- Allow filtering by number, title, or author in the picker
- Support typing custom PR number or URL
- Renamed command to "Checkout Pull Request..."
- Import PRType for fetching all PRs

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Show most recent PRs first for better usability

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
- Properly dispose event listeners after promise resolves
- Remove unrelated changes to proposed API file

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
- Handle case when user presses Enter with no selection
- Make disposables optional to prevent undefined access

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Move QuickPick and event listener cleanup to finally block

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
src/commands.ts Outdated

// Fetch all open PRs
try {
const prs = await githubRepo.manager.getPullRequests(PRType.All, { fetchNextPage: false });
Copy link
Member

Choose a reason for hiding this comment

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

@copilot We shouldn't use the getPullRequests method here, as it gets more info that just the number. Add a new graphql query and a new method getPullRequestNumbers, which just gets all the open pr numbers, titles, and authors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Created a new PullRequestNumbers GraphQL query and getPullRequestNumbers() method that fetches only the PR number, title, and author. The command now uses this lightweight query instead of getPullRequests(). (commit a399622)

package.nls.json Outdated
"command.pr.showDiffSinceLastReview.title": "Show Changes Since Last Review",
"command.pr.showDiffAll.title": "Show All Changes",
"command.pr.checkoutByNumber.title": "Checkout Pull Request by Number",
"command.pr.checkoutByNumber.title": "Checkout Pull Request...",
Copy link
Member

Choose a reason for hiding this comment

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

@copilot Don't change the title.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted the title change. It's back to "Checkout Pull Request by Number". (commit a399622)

Copilot AI and others added 3 commits December 12, 2025 10:19
- Created PullRequestNumbers query that fetches only number, title, and author
- Added getPullRequestNumbers() method to GitHubRepository
- Updated checkout command to use new lightweight query
- Reverted title change in package.nls.json per feedback

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
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.

Check out pull request by number should show PRs in picker

2 participants