-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Link from VS to Github in Browser #106
Description
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:
- switch to the browser
- open a new tab
- type in the url for the repo
- switch to the right branch
- hit
t
, type in the name of the class - hit enter (if its the first result)
- then scroll through a file which could have 200-500 lines of code for the specific line I'm referencing
- click the line that I'm interested in
- copy the link
- finally I get to continue on
Logic
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
- If the github repo/branch doesn't have the same version of the file that I do or if the file/branch doesn't exist at all
- To start with I would expect that this feature would just generate the link without doing any verification... For my cases, this is almost never the case and when this does happen I'm usually know whether I've pushed the changes up or not
- In the future, you could do a diff between what the known state of the origin is locally and see if that is going to cause a conflict or affect the link you would generate... this still isn't perfect but percentage wise deal with most of the edge cases
- In the future future, you could do a check against what the actual state for the remote repo is... In practice this isn't likely to work all that well due to the latency of the check
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