Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Open file from GitHub (MVP) #2060
Conversation
When user clones a /blob/ type URL, navigate to the file after cloning/opening the repository.
990782b
to
cadf19a
Default to clipboard URL when cloning form Start Page and Connect page. This makes it consistent with current File > Open > Open from GitHub behavior.
b32ad70
to
999e41b
Remove gitHubContextService from OpenFromUrlCommand.
75164dc
to
d3228ab
Move context changing responsibilities away from RepositoryCloneService.
Warn when blob can't be found in the repository. Warn when the working file is different blob URL file.
f9f7bd8
to
030e2da
|
I opened the dialog with some random markdown in my clipboard.
|
Don't close solution and open folder view when solution is already in the targeted repository.
|
Thanks @StanleyGoldman, will fix #2060 (comment) next week in a separate PR. |

This is a MVP implementation of open file from GitHub functionality.
With this functionality the user can paste a
/blob/style URL into theURLtab of theOpen from GitHubdialog and be taken to the file/line/range after the target repository is opened or cloned.When the target
/blob/isn't available in the working directory, a dialog will appear letting the user know about the problem. There is no functionality to assist navigation to an alternative remote branch or pull request (if that is where the/blob/URL is from).This functionality isn't advertised/discoverable and will be primarily used for gathering user feedback and testing when the functionality is explicitly pointed out.
Scope of MVP
https://github.com/owner/repo/blob/<branch>/<path>/<file>style URLshttps://github.com/owner/repo/blob/<SHA>/<path>/<file>style URLs#L10and#L25-L33)Next iteration
Open from GitHub / URLpageWhat this PR does
Open from GuitHubandOpen from ClipboardfunctionalityURLtab ofOpen from GitHubdialog when there is a GitHub URL in the clipboard.GitHubContextService.TryNavigateToContextfor syncing Visual Studio context with context from a/blob/URL/blob/URL/blob/URL doesn't exist in local repository/blob/URL is a permalink, we don't currently know the remote branch/PR it is associated withNotes and Issues
When a user opens a blob permalink, we don't know the name of the branch they're targeting
When a user opens a blob from a named branch, files on the current branch might be different to the target branch
If the user hasn't recently done a fetch, the targeted commit might not exist or the link might be out of date (if it uses a named branch)
When a range of lines is selected and a solution is opened using
Team Explorer - Home, the selected text is lost but the caret position remains the sameDiscoverability
This feature isn't being advertised in the MVP
With this new functionality a user can paste a
blobstyle URL into theOpen from GitHubdialog and have the target file and line number/range selected as soon as thecloneorOpencompletes. We need to find a way to make this functionality discoverable.Currently is a user copies a
blobstyle URL into their clipboard clicksFile > Open > Open from GitHub..., they will be presented with this:If there is no URL in the clipboard, they will see this:
For the MVP I think it would make sense to work on these incrementally. Start off with a static description and only show elements of the deconstructed URL if they're deemed to be particularly useful.
What do you think @donokuda?