Move away from my main content line in Spring Boot series, I want to insert this topic between the main content. Why? Because this IDE is quite new for me to use when I code Java. I faced a lot of problem with setting up the IDE and spent a lot of time to familiarize with the tool. The IDE I’ve been talking about is Visual Code. If you’ve ever heard about Visual Studio from Microsoft, yeah Visual Code is released by Microsoft as Open Source project.

Once, I was a C# developer. I used Visual Studio for everything. I found it heavy on my laptop. Then a few months ago, I started to explore Java. I used Eclipse most of the time. Without me realizing, my laptop couldn’t handle it. Eclipse is very heavy and made my laptop stopped working.

Then a few weeks ago, my colleague introduced me to this Visual Code IDE. This IDE is a lightweight IDE. And yeah. It was light and simple. You install what you need only. The interface is very.. hollow… Not much to see.

What is the difference between VS Code and VS Community Edition

Both are free. But one is a complete IDE, and others is a lightweight IDE. Actually community edition is not a complete version one, but at least it gives all the basic of what developers need. All the settings are there. However, VS Code needs your experience to just setup the IDE. The concept of VS Code is extension-based IDE tools. I spent a day to familiarize with this extension concept of IDE. You only install extension you need. That is why this IDE is lighter than its predecessor.

VS Code has less interface menu. Most of the menu are hidden. You can execute any instruction using terminal.

Getting Started

To grasp easily how to use VSCode, I will give an example how I create a new SpringBoot Project using VSCode

  1. Download and install the Visual Code.
  2. Install the Spring Boot Extension Pack from Extension menu

 

  1. To create new Spring Boot project, you have to run Spring Initializr from Command Palette
  2. You may open Command Palette from View -> Command Palette, or shortcut key (ctrl+shift+P)
  3. Type Spring Initializr.
  4. Choose either generate Gradle project or Maven project. I will choose Gradle
  5. Just follow the step to complete the palette wizard.
  6. Fill your group id (e.g com.example)
  7. Input your artifact ID, or the name of your project
  8. Specify Spring Boot Version. I choose 2.1.3, the recent one and stable one.
  9. Pick your dependencies by clicking it. And click enter when complete.
  10. Voila! you are ready to code!

 

GUI 101

After generate a new Spring Boot project, you will see following interface.

The most left navigation bar is the basic icon and all extension that you’ve added. From Top to Bottom: Explorer, Search, Source Control, Debug, Extensions, Test, Docker and Gitlab (see the figure above).

Explorer

If you add Spring Boot Extension, you may see the Spring Boot Dashboard at the bottom group. Here you can run the service you’ve created by right click and choose Start to start the service. Sometimes you need to wait for the server appeared. It takes time to load everything I guess.

Usually whenever you create new project, you have 2 choices: either display it in separate window or add to current working workspace.

Workspace is the term for your working space folder 😀 you can put all projects together under the same workspace, so it is easy to view it when the project is correlated each other. If you don’t save the workspace, you might lose this view. You have to save it before closing the IDE. Then load the workspace whenever you want to work again with it on the next day.

Terminal

This is important window to get familiar with. Honestly, when I was using Eclipse, everything can be executed using GUI. But not in VS Code. I need time to find the right command instruction to execute something.

VS Code has own navigation menu for Terminal. You may open the new terminal from there. You also are able to choose which terminal to use. In Windows, you have 3 options: CMD Terminal, Powershell and Git Bash. Open the command palette (shift+ctrl+P), type Terminal: Select Default Shell.

Conclusion

My verdict as per I wrote this article is I like this tools because of its light. Much lighter than my eclipse. I can use command-based terminal to execute instruction. Well, like I said, this IDE doesn’t have much interface menu. Most of the menu is executed by command prompt. That is why we need at least familiarity with terminal.

Convenience to use when developing microservice-based application. Since you need to run a lot of services at the same time, I need most of CPU allocated for my service. Not my IDE.

In next article, I will write step-by-step how to integrate Visual Code with Git. Unlike Eclipse, Git instruction is executed using terminal 😀