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.
Link from VS to Github in Browser #106
Comments
|
I'd love this! |
|
That would be awesome! |
|
+1 would be great to have this |
|
Thanks for the awesome suggestion! |
|
BTW, there's already code in place to handle menus and commands. The package adds context menus in the "Connections" area like this - https://github.com/github/VisualStudio/blob/master/src/GitHub.VisualStudio/GitHubPackage.cs#L51 |
|
@shana @avanderhoorn Has this feature been implemented yet? I'm willing to make a PR for this if no one else has started. |
|
As far as I know, no work has started on this. |
|
Happy new year everyone! Indeed, work has not been started on this. Not enough hands and omg I needed a rest after last year! I would LOVE a PR on this, these are the little things that really make coding easier. I've created a new branch for this feature and added some things you will need to get this working, to start with: https://github.com/github/VisualStudio/tree/feature/link-to-vs. The branch adds the "Get Link" context menu and a handler for it, and gets the file name and line from VS, as an example. Here's some thoughts on how to do this: The link can be to a commit hash, so no need for branch information. No need to even check if the local file matches the remote version, I agree, just generate the link with the line and let people sort it out if they don't match exactly. You can use
If it's not null, In the command handler of From the Get the |
|
@shana Wow, thank you for all the information! I'll go ahead and get started. If we
this doesn't seem too complicated. |
|
I have completed a basic implementation for the opening of a single line or a group selection. Above is a sample link that it made. Before I dive into the nested menu controller to include the copy to clipboard feature, are there any current examples in the app so I can match that coding style? |
|
@austin94 For the copy link command, just add another button/idsymbol/pkgcmdid entry for it and then call |
|
BTW, I'm on a GMT+1 timezone, so delays in replies may occur :-P |
|
@shana I probably should have waited to share the link above until I had finished refactoring! I've implemented the comments you made along with the addition of the 'Copy Link to Clipboard' feature. You can view the commit here: https://github.com/austin94/VisualStudio/commit/d4d77627b33a5bad4c3d27696594f58d97e04d36 |
|
I'm confused - when will this make it in to the extension? I just started using this other extension in the meantime: https://github.com/neuecc/Open-on-GitHub |
|
@dmorrison This has been out for a few months already |
|
@shana, great! Where is this menu? |
|
Ah - nevermind, kind of... So I see the command here. Is it supposed to be exposed by default in any menu or default shortcut? |
|
@dmorrison When you right-click in the editor on a file, there's a GitHub menu with the submenus for links. |
|
We didn't actually put it in the context menu of files in the solution explorer, just when right clicking on the contents in the editor. We should probably do that :-P |
|
Hmm, I don't see it when I right click (that "Open on GitHub" item is for the other extension I mentioned), and I think I'm using the latest extension: http://screencast.com/t/Wbvp04lhp. Also, I'm using GitHub Enterprise, so maybe that's it? Sorry for the confusion, and thanks! |
|
That's odd. I assume the project is published to github (or enterprise)? Can you post a screenshot of the Team Explorer home page so I can see if it knows it's a github repo? Or send it to windows@github.com if you'd prefer to send that privately. |
|
Yes, it is published to our internal GitHub Enterprise server. Here's the Team Explorer home page. |
|
So just to confirm, this is not working with Git Enterprise? We have some private repos and I would love to use this. |
|
@bsivanov, correct - it didn't work for me in GitHub Enterprise. |

Request
I would love for a feature to be added where I could right click on a given line and either open the browser up at that line for the given branch on Github and/or copy the link to my clipboard.
Background
In a given day I've lost count of how often I am talking to someone remotely (via twitter/skype/slack/etc) and I'm wanting to reference a line of code and the easiest way to do that is get the file up on Github... from that decision to the point where I find the relevant file/line and get the link is a good 30-60sec of time and like at east 5-10 clicks and a major context switch.
Current Workflow
I have to:
t, type in the name of the classLogic
Github for VS already knows if I have a git repo, if that repo origin is github and what branch I'm on. From there, it should be reasonable to think that a URL for that exact spot should be able to be generated.
Edge Cases
I wouldn't let the above stop the feature, because as I mentioned, I usually am aware of the state of changes I've made and even if its not exact, usually getting me within range of the correct line saves me a ton of work.
Other IDEs and Text Editors
This isn't specific to VS, the same feature makes sense in @atom, VS Code, etc, etc
The text was updated successfully, but these errors were encountered: