r/node • • Aug 18 '21

A VS Code extension that finds common open-source code patterns

393 Upvotes

31 comments sorted by

32

u/grubstreet1 Aug 18 '21

Get it here! Works for JS and TS!

When I'm getting familiar with a new library I often look through open-source code to see how other developers use its functions. For example, when I was learning axios I looked through Github repos to see how people handled HTTP request errors.

But using a combination of Github and Google to search for code is inefficient and frustrating, so I built an extension that extracts common usage patterns from open-source code and displays them in a sidebar - so as you use functions you can see how other developers have used them too. Hover over the blocks of highlighted code and see just how common the pattern is.

The extension also:

- Displays code examples scraped from library documentation

- Has a search engine that lets you search for npm module functions in plain english

Let me know what you think! Thanks!

4

u/muiz1 Aug 19 '21

Will you be making a vim plugin like this one?

2

u/-_-seebiscuit_-_ Sep 12 '21

Looks super interesting! Well done!

Question, how did you go about learning how to make vscode extensions? I'm thinking of writing one (completely unrelated) and I'm finding it a bit slow to start.

18

u/taschana Aug 18 '21

Looks cool! But the copy paste could probably be made a bit more comfortable, like a button on the lines' beginning saying "copy line into my file at cursor position". Pure perfection.

15

u/grubstreet1 Aug 18 '21

Completely agree, and working on it for an upcoming release!

5

u/taschana Aug 18 '21

That sounds great :)

I will have a look at it once I can continue working on my project.

5

u/[deleted] Aug 18 '21

How can I use it ? Sounds interestingg !!

3

u/grubstreet1 Aug 18 '21

Nice! You can download it here. Let me know what you think!

4

u/Professional-Trick14 Aug 18 '21

Wow that's actually so useful. I may have to give it a try!

1

u/grubstreet1 Aug 18 '21

Thanks! Give it a try and let me know what you think!

4

u/akshay-nair Aug 18 '21

I like this better than co-pilot. Great job! Any hope for vim/nvim plugin for this?

3

u/grubstreet1 Aug 18 '21

It's just VS Code for now - will look into vim implementation though ;)

43

u/JND__ Aug 18 '21

Sounds like a Copilot with extra steps. /s

42

u/catNamedStupidity Aug 18 '21

Honestly this looks like copilot with better attribution

5

u/JND__ Aug 18 '21

Not denying that, I think that it is cool. Just made a little joke about that.

1

u/catNamedStupidity Aug 18 '21

I got that. Don't think you're denying it good sir

20

u/iam_the_resurrection Aug 18 '21

Except you can use it today

2

u/Rudecles Aug 18 '21

Ooh-la-la. Someone’s going to get laid in college.

3

u/JND__ Aug 18 '21

Yeah, definitely not you.

2

u/Rudecles Aug 18 '21

:( it was a Rick and Mitty reference.

1

u/JND__ Aug 18 '21

Jesus Dude I'm sorry, it didn't snapped on my side (like nothing today, bad day it was).

1

u/[deleted] Aug 18 '21

[removed] — view removed comment

2

u/JND__ Aug 18 '21

Sorry, next time I'll just flip a finger.

3

u/misterjyt Aug 18 '21

Wow Nise JOB!. it might become a competitor of GitHub Copilot.

1

u/turtle_mekb Aug 18 '21

is this for atom?

4

u/grubstreet1 Aug 18 '21

Just for VS Code at the moment - will look into an atom implementation though in future

3

u/i_kurt_i Aug 18 '21

Any chance for webstorm/IntelliJ too? :)

1

u/adantj Aug 18 '21

Is the tool itself open source?

1

u/334578theo Aug 19 '21

Where do the code snippets come from? Public Github repos? If so, how do you decide what is a good snippet and what is a bad snippet?

Not trying to pick holes, just there is a lot of very average code out there.

1

u/wekatoa Aug 19 '21

look great. I am waiting for supporting other languages such as Python, Java...

0

u/[deleted] Aug 18 '21

[deleted]

12

u/grubstreet1 Aug 18 '21

I post when I’ve made major new updates. A few weeks ago I wrote in r/node that I was working on retrieving open-source code examples, so just wanted to let the community know that they're now ready to use!