Do you want to speed up the process of coding by creating your own boilerplate code?
In this tutorial, we are going to show you how to implement the SaaSberry boilerplate into VS Code and reuse it fast.
How do you create a boilerplate in VS Code?
Step 1. Choosing the code snippet
At first, we need to find the piece of code we require to be reused as a block and call it later.
The code snippet we are going to use for this tutorial is going to be written in Java.
–Code–
public class Main {
public static void main(String[] args) {
System.out.println(“Hello, World!”);
}
}
Step 2. Creating the Snippet in VS Code
To begin with snippet creations, we must follow a few simple steps, which require opening VS code and clicking on the options tab.
From there, choose the “Create Snippet” option and start typing the programming language you wish to use. In our case, we will be using Java to create our feature snippet.

The next thing you will see is a suggestion on where you should be placing your Java Snippet file.

Copy the boilerplate code, and then paste it between the curly brackets “{ }”, and save the file.

Until now, we have followed the basic instructions, but here’s what they mean:
The “prefix” option specifies the shortcut text that triggers the snippet. When you type “helloworld” in a .java file and press Tab or Enter, the snippet expands into the predefined Java code.
The “body” contains the actual Java code that will be inserted. Each line of code is enclosed in double quotes and separated by a comma. The body defines a complete Java program with a main method that prints “Hello, World!” to the console.
The “description” is an optional field that provides a brief explanation of what the snippet does. It helps users understand the purpose of the snippet when browsing available options in the snippet suggestions.
The snippet must be placed inside java.json, which is the user-defined snippet file for Java in VS Code. When configured correctly, typing “helloworld” in a Java file triggers the snippet, expanding it into a complete Main.java structure.
Step 3. Running the boilerplate
Now that we have a functional boilerplate in VS code, the next thing we need to do is call it by its prefix name.
Simply open up a new window and choose the programming language that corresponds to the boilerplate you have saved.
Start typing in the name of the prefix, and you should see a suggestion to call the boilerplate directly.

In some cases, your boilerplate might not show as a callable option. In such cases, make sure to save your files and restart VS Code. After restarting the saved boilerplate, the code will become available to be called as a function.
If not, hover back to option one and test with the example of boilerplate code we have given you.
To speed up the process of creating applications and web apps with boilerplate code in VS Code, you may want to try out The Easy Boilerplate extension for Visual Studio Code.
We have also included instructions on how to install extensions in VS code.