Open a session's linked PR, issue, or commit in the browser#224
Open
jongio wants to merge 1 commit into
Open
Conversation
Add a 'g' key binding and 'Open Reference' command palette action that open the selected session's linked reference on github.com. The best reference is chosen in order: pull request, issue, then commit. - data.BestRef picks the most useful ref for a session - data.RefURL builds a github.com URL from the repository slug or remote URL and validates pr/issue numbers and commit SHAs - platform.OpenURL opens only http/https URLs in the default browser Closes #220 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
What
Adds a way to jump straight from a session to its linked pull request, issue, or commit on github.com.
Press
g(or pick "Open Reference" from the command palette) with a session selected and Dispatch opens the most useful linked reference in your browser. The pick order is pull request first, then issue, then commit.Why
Sessions already track their linked PRs, issues, and commits, and the preview pane lists them, but there was no way to act on them. Opening the PR or issue meant copying the number and navigating by hand. This closes that gap the same way
Oopens the working directory.How
data.BestRefreturns the highest-priority reference for a session (pr > issue > commit).data.RefURLbuilds a github.com URL. It accepts anowner/reposlug or a git remote URL (https or ssh), pulls the digits out of pr/issue values so stored forms like#42still resolve, and checks that commit values look like a SHA.platform.OpenURLopens only absolute http/https URLs, so a malformed value never reaches the OS opener.gbinding and an "Open Reference" palette action, guarded so it only shows when the session has a repository and at least one usable reference.Tests
data.RefURLanddata.BestRefcovering slugs, remote URLs, prefixed values, and rejection cases.platform.OpenURLtests rejecting empty, scheme-less, non-http, and host-less URLs.Closes #220