naquiuddin
9 days ago

Snippets are awesome. Creating one is painful. This saves time.

We sometimes write the same code multiple times. For example Configs (related to webpack bable, prettier, eslint etc), frequently used react component code and other boiler plate code.

Some of us store them in GitHub's Gists, but have to copy paste it when required. Snippets are handy shortcuts to generate code for us. For example if you type imp in VS Code's JavaScript file, it automatically creates import <some space> from '<cursor shows here>'. You can type the package name and then press tab to automatically move cursor to another step. Just try it yourself.

We can create our own custom snippets for frequently written code to increase productivity. However writing it is painful. So here is a handy tool that creates snippet for you.

This tool works for sublime, atom and VS Code. However I like VS Code so this one is mostly about it.

https://snippet-generator.app/

Just copy paste your code on left side. Add $1 for first tab, $2 for second tab and so on. On the right side you will see snippets generated automatically for you.

After that Go to 'Preferences' > 'User snippets' and select the correct type, then paste in the copied code. Discover more from the VS Code snippets docs.

Do you have any comment on this tricks? then let the author know about that. comment here