DEV Community

hasanmn
hasanmn

Posted on

1

How to Create Your Own Snippets in VS Code

I am always looking for a new way to improve my workflow, to be more efficient. I found that using snippets is one of many things that surely can enhance my productivity. With snippets, using only several characters you get a chunk of codes that you often use. Certainly, there are a lot of snippet extensions in the VS Code marketplace. These snippets are super awesome, offering you a huge number of snippets; any snippet that you can imagine probably exists there. But, to be honest, I only use a few of them, and I have a hard time remembering their prefixes. I feel that it is better to create my own snippet that suits my own workflow, and hence I can remember easily.

Here is how I create my own snippets:

  1. Install Snippet Creator Extension

  2. In the editor, type a block of codes that you want to use as the snippet. Highlight them, open the command palette ( use ctrl + shift + p), select Create Snippet, and if you follow the suggested options, you will be fine.
    Create Snippet

  3. Modify the created snippet to further accommodate your needs. Open command palette and select Preference: Configure User Snippets.
    Modify Snippet

Now you can enjoy it.
Use Snippet

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay