fabiospampinato/vscode-open-in-github

Support "copy as github permalink" command

Closed this issue · 6 comments

Would be super useful to run run copy as github permalink command and paste a snippet into github comments and have it render super nicely.

https://help.github.com/en/articles/creating-a-permanent-link-to-a-code-snippet

example (see in preview - link contains commit hash)

async function open ( file = false, page? ) {
const repopath = await Utils.repo.getPath ();
if ( !repopath ) return vscode.window.showErrorMessage ( 'You have to open a git project before being able to open it in GitHub' );
const git = Utils.repo.getGit ( repopath ),

That'd be useful, PR welcome 👍

So I do this at-least 10 times a day and I'm kind of fed up making three clicks for this everytime and I'm pretty sure I've spent more time fighting this than it would take me to make a PR so I'm going to stop what I am doing and send you a PR. Incoming 🚀

I take it back. After spending two days and fighting simple-git, it was a lot harder than I imaged.

calling git.log or git.raw or other git methods, it barfs with

rejected promise not handled within 1 second: TypeError: Buffer.concat is not a function
extensionHostProcess.js:783
stack trace: TypeError: Buffer.concat is not a function
	at /Users/nojvek/git/vscode-open-in-github/out/extension.js:20121:39

You might want to try updating simple-git, I think we are using an older version of the library.

Implemented in v1.3