Add Codespaces checkout option to PR dropdown and tree context menu#8298
Merged
Add Codespaces checkout option to PR dropdown and tree context menu#8298
Conversation
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add option to checkout PR on Codespaces
Add Codespaces checkout option to PR dropdown
Dec 11, 2025
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Contributor
Author
Done in commit a486961. The "Checkout Pull Request in Codespaces" option now appears in the right-click context menu for PR items in the pull requests tree view, positioned right after the "Checkout Pull Request on vscode.dev" option. It opens the PR branch in a new GitHub Codespace using the URL format: |
Copilot
AI
changed the title
Add Codespaces checkout option to PR dropdown
Add Codespaces checkout option to PR dropdown and tree context menu
Dec 12, 2025
alexr00
reviewed
Dec 12, 2025
src/commands.ts
Outdated
Comment on lines
719
to
738
| if (pr === undefined) { | ||
| // This is unexpected, but has happened a few times. | ||
| Logger.error('Unexpectedly received undefined when picking a PR.', logId); | ||
| return vscode.window.showErrorMessage(vscode.l10n.t('No pull request was selected to checkout, please try again.')); | ||
| } | ||
|
|
||
| let pullRequestModel: PullRequestModel; | ||
|
|
||
| if (pr instanceof PRNode || pr instanceof RepositoryChangesNode) { | ||
| pullRequestModel = pr.pullRequestModel; | ||
| } else { | ||
| pullRequestModel = pr; | ||
| } | ||
|
|
||
| if (!pullRequestModel.head) { | ||
| return vscode.window.showErrorMessage(vscode.l10n.t('Unable to checkout pull request: missing head branch information.')); | ||
| } | ||
|
|
||
| return vscode.env.openExternal(vscode.Uri.parse(codespacesPrLink(pullRequestModel))); | ||
| }), |
Member
There was a problem hiding this comment.
@copilot Reduce duplicate code between here and pr.pickOnVscodeDev.
Contributor
Author
…odespaces Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
alexr00
approved these changes
Dec 12, 2025
alexr00
approved these changes
Dec 12, 2025
bpasero
approved these changes
Dec 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation Complete ✅
Features Added
1. PR Overview Dropdown
pr.checkoutOnCodespacesFromDescription2. PR Tree Context Menu
pr.pickOnCodespacesCode Quality Improvements
Refactored duplicate code
pr.pickOnVscodeDevandpr.pickOnCodespacesinto helper functionpickPullRequestasynckeyword to command callbacks for clarityTechnical Details
Helper Function
Usage
pr.pickOnVscodeDev→async (pr) => pickPullRequest(pr, vscodeDevPrLink)pr.pickOnCodespaces→async (pr) => pickPullRequest(pr, codespacesPrLink, true)Quality Assurance
Fixes #7424
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.