Create gist from Visual Studio #39

Closed
tkirill opened this Issue Aug 6, 2015 · 16 comments

9 participants

@tkirill

Is it possible to create gist from selected lines with this extension?

@Haacked
GitHub member

Not today, but it wouldn't be hard to add.

@Haacked Haacked added the feature label Aug 6, 2015
@Haacked
GitHub member

How often do you think you'd use that?

@vorou

+1
It's not mission-critical, but I'm sure I feel sad at least twice a week because I have to open the browser and open the site and copy-paste stuff and then copy link. Oh god, it's even more painful now when I described that.

@Haacked
GitHub member

I think we have some code for doing this laying around even. We had implemented this in GitHub for Windows and then removed it because it was so undiscoverable. We relied on a keyboard shortcut.

Would would be nice is if we could inject ourselves in the context menu when you select a snippet of text in the Visual Studio editor. I'm not sure if that's possible.

Alternatively, we could add a menu to Create Gist from Selection. We should think through the user experience before setting to work on it.

@tkirill

How often do you think you'd use that?

Regulary, but not very often.

We should think through the user experience before setting to work on it.

Both options are fine for me as long as I can reach them with keyboard. Context menu may be more intuitive though.

@shana shana added this to the 1.2 milestone Aug 13, 2015
@shana shana added the help wanted label Aug 13, 2015
@shana

Notes for help-wanted label

This is a nice small feature that could be very interesting for someone wanting to contribute to the project! If you'd like to tackle this (hurrah!), here are the steps that should go into making it happen:

  • Define the User Experience for the feature
    • How would users go about using it? Context menus? Keyboard shortcuts? Action tags? What is the discoverability path for it?
    • Mockup the flow of the experience - what happens from the point where a user wants to create a gist to the point where the action is completed. Does it popup a window? Show a notification? A dialog? What options would there be for creating the gist, if any? Is it a one-click thing or a more complex flow? Does the feature need user settings or configurations?
  • Implement!
    • Fork and create a branch for the feature, and create a PR for the branch. You build the PR over time as you implement things, and practical implementation discussions happen there!
  • 🚢
@ChristopherHackett

Thinking about the process to create a gist from code in the editor

Select code
Ctrl + C
Ctrl + Tab (until browser)
Ctrl + T 
Start typing 'gist' and hit return when http://gist.github.com appears 
Name gist and hit tab
Ctrl + V
Review code doesn't contain sensitive information 
Mouse to 'Create secret gist' or 'Create public gist' 
Select URL
Ctrl + C
Ctrl + Tab (until in email, IM or other communication tool)
Ctrl + V 

Some observations

  • There is definitely a need for the text been gist-ed to be reviewed before been sent to GitHub.
    • Code and text is leaving the users control. There must be a way to abort in the event of incorrect invocation.
    • On creating a gist via the API you need to specify if it is public or private. Also any future redaction by default will remain in the history of the gist!
  • Users are using gist to share something
    • The last point should make it simple to get the URL of the gist
    • What about services like bl.ocks and Neo4j GraphGist which auto wrap gists into a more useful formats. Should users be able to enable/add these types of third party services?

Anyone want to add any more observations/comments before starting on the new experience?

@vorou

Would be cool to have as few clicks as possible. I believe it's OK if in first version it just creates private gists without asking. It's the main reason why you need such kind of extension — most of the time you just want to show the code to teammate(s), not to create some useful peace of wisdom.

I agree, preview is a must.

So, to me it looks like this:

  1. Highlight the code.
  2. Click/press «Gist it».
  3. Preview (right in the editor, probably).
  4. «The gist url was copied to the clipboard» balloon appears.
@shana

For a first version, it's fine (and preferable!) if the experience be kept as simple as possible. We can always add more features and options later.

  1. Highlight the code.
  2. Click/press «Gist it».
  3. Preview (right in the editor, probably).
  4. «The gist url was copied to the clipboard» balloon appears.

This feels like a good first approach.

@tkirill

Anyone want to add any more observations/comments before starting on the new experience?

I looked at how integration with Gist implemented in Intellij IDEA.

How would users go about using it? Context menus? Keyboard shortcuts? Action tags? What is the discoverability path for it?

I think it is true that many people use mouse for highlighting. So the context menu which opens by right click looks good for "Gist it" command. Intellij IDEA implements Gist support in such way so this is time-proven.

About preview. I already know and I see what code will be in the gist -- it is highlighted by me a moment ago. As for me the preview is not necessary. Also, IDEA doesn't have it and there are no requests for it.

This feels like a good first approach.

Yeah 👍

@SamirHafez

I actually tried to do this one a while back and couldn't get past adding the VSCT entry :D

@DoCode

👍
come on guys

@jpobst

If anyone wants to tackle this and needs a starting point, I committed some old code I had laying around. It shows you how to add the context menu item and then retrieve the selected text (or whole file) from the code editor.

After that you would need to hook into the existing GHVS infrastructure to submit the gist, as well as any UI you want to display.

https://github.com/jpobst/GistPaste/blob/master/GistPaste/PasteToGistCommand.cs

@shana

@jpobst Nice! 😄

@shana

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

@grokys grokys was assigned by shana May 2, 2016
@shana shana referenced this issue Jun 6, 2016
Merged

Feature: Gist support #194

3 of 3 tasks complete
@grokys

This has now landed in master!

@grokys grokys closed this Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment