feat(filetree): open the selected file or directory on GitHub#331
Open
jongio wants to merge 1 commit into
Open
feat(filetree): open the selected file or directory on GitHub#331jongio wants to merge 1 commit into
jongio wants to merge 1 commit into
Conversation
Add a `B` keybinding to the file tree that opens the entry under the cursor on github.com in the default browser, pinned to the current HEAD commit. Files open at their blob URL and directories at their tree URL. The tree could open files locally (editor, default app) but had no way to jump to the same file on GitHub. The handler resolves the git root and origin remote, converts the remote to an https github.com base with the existing RemoteToHTTPS helper, computes the repo-relative path, and builds `/blob/<sha>/<path>` for files or `/tree/<sha>/<path>` for directories. Path segments are percent-escaped. It is a no-op when nothing is selected and shows a clear toast when the repo has no github remote or the entry sits outside the repository. `o` (open in editor) and `O` (open in default app) were already taken, so this uses `B` for browse. keybindings.json and docs/keybindings.md are updated. Closes #325 Co-authored-by: Copilot App <[email protected]>
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.
Adds a
Bkeybinding to the file tree that opens the entry under the cursor on GitHub in the default browser, pinned to the current HEAD commit.Files open at their
blobURL and directories at theirtreeURL. The tree could open files locally (editor, default app) but had no way to jump to the same file on GitHub.Changes
openOnGitHub()handler plus a pureblobTreeURLbuilder ininternal/panels/filetree/github.goBkey into the dispatch switch andKeyBindings()(oandOwere already taken by the local open actions)keybindings.jsonand regenerateddocs/keybindings.mdBehavior
https://github.com/<owner>/<repo>/blob/<sha>/<path>.../tree/<sha>/<path>.../tree/<sha>Verification
go build ./...cleango test ./internal/panels/filetree/ ./internal/keybindings/passCloses #325