Skip to content

Add "Checkout Pull Request" command to chat session context menu#7669

Merged
rebornix merged 6 commits intomainfrom
copilot/fix-fc17c613-4d9f-4dc6-ba79-f39b3e5089dc
Aug 26, 2025
Merged

Add "Checkout Pull Request" command to chat session context menu#7669
rebornix merged 6 commits intomainfrom
copilot/fix-fc17c613-4d9f-4dc6-ba79-f39b3e5089dc

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 26, 2025

This PR adds a "Checkout Pull Request" command to the context menu for chat session items in the GitHub Pull Requests extension. The new command is positioned above the existing "Close Pull Request" command as requested.

Changes

New Command Implementation

  • Command ID: pr.checkoutChatSessionPullRequest
  • Title: "Checkout Pull Request"
  • Functionality: Allows users to checkout the pull request associated with a chat session directly from the chat session context menu

Technical Details

The implementation follows existing patterns in the codebase:

  1. Command Declaration (package.json):

    • Added command definition with proper localization reference
    • Integrated into the chat/chatSessions context menu with appropriate conditional logic
  2. Command Function (src/commands.ts):

    • Extracts the pull request from the ChatSessionWithPR argument
    • Locates the appropriate folder manager using repository owner/name
    • Reuses the existing switchToPr function for consistent checkout behavior
    • Includes proper error handling and logging
  3. Menu Integration:

    • Positioned above "Close Pull Request" in the context menu
    • Uses the same conditional (chatSessionType == copilot-swe-agent) as other commands
    • Maintains consistent UX with existing chat session commands

User Experience

Users can now:

  • Right-click on a chat session item
  • Select "Checkout Pull Request" from the context menu
  • Have the associated pull request checked out locally with the same behavior as other checkout commands

This enhancement improves workflow efficiency by providing direct access to pull request checkout functionality from the chat sessions view.

Testing

  • ✅ Code compiles successfully
  • ✅ Passes all hygiene checks and linting
  • ✅ Follows existing code patterns and conventions
  • ✅ Integrates seamlessly with existing chat session functionality

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits August 26, 2025 17:58
Co-authored-by: rebornix <876920+rebornix@users.noreply.github.com>
- Add pr.checkoutChatSessionPullRequest command to package.json
- Add localized title to package.nls.json
- Implement checkoutChatSessionPullRequest function in src/commands.ts
- Register command in src/commands.ts
- Add command to chat/chatSessions context menu positioned above Close Pull Request
- Reuse existing switchToPr functionality for checkout logic
Copilot AI changed the title [WIP] add "Checkout Pull Request" to the context menu for the chat session item (it should be be above the Close Pull Request) Add "Checkout Pull Request" command to chat session context menu Aug 26, 2025
Copilot AI requested a review from rebornix August 26, 2025 18:14
@rebornix rebornix marked this pull request as ready for review August 26, 2025 23:48
@vs-code-engineering vs-code-engineering Bot added this to the August 2025 milestone Aug 26, 2025
@rebornix rebornix merged commit 10a2e13 into main Aug 26, 2025
3 checks passed
@rebornix rebornix deleted the copilot/fix-fc17c613-4d9f-4dc6-ba79-f39b3e5089dc branch August 26, 2025 23:59
@alexr00 alexr00 restored the copilot/fix-fc17c613-4d9f-4dc6-ba79-f39b3e5089dc branch August 27, 2025 08:37
Comment thread package.json
"category": "%command.pull.request.category%"
},
{
"command": "pr.checkoutChatSessionPullRequest",
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.

We should exclude this command from the command palette by adding an entry with when false in

"commandPalette": [
{

@alexr00 alexr00 deleted the copilot/fix-fc17c613-4d9f-4dc6-ba79-f39b3e5089dc branch August 27, 2025 08:41
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.

4 participants