Setting Up VSCode for Ballerina Development in 60 Seconds
Focus
Ballerina comes with an ecosystem which contains a rich set of tools to provide ballerina developers a streamlined development experience. I’ll write a separate article explaining about all the tools available for Ballerina, later.
In this article, I am going to have a look at how to set up Visual Studio Code (VSCode) for Ballerina Development.
Download Editor and Plugins
You can download VSCode Editor from their official web site.
In order to provide the Ballerina development capabilities you need to install Ballerina VSCode Plugin. You can find the plugin from VSCode Market place.
Installing Ballerina Plugin
You can install the plugin following bellow two approaches.
Install from downloaded plugin (vsix) file
You can download the official extension (vsix) from VSCode market place or from Official Ballerina web site.
- Install from command line
code --install-extension <path to ballerina extension>
- Install from vsix through editor
Install from Market Place (From Editor)
Configure Ballerina Home
Once you install the Ballerina plugin you can start ballerina development. When you open a .bal file after installing the plugin, you will be prompted with a warning message as below.
This is because, in order to function the plugin, you need to add the user setting option ballerina.home. Go to user settings and add the path to your ballerina home directory. For an example, if you are on Linux and you installed ballerina from our standard Linux installer, your ballerina home configuration would be as following,
"ballerina.home": "/usr/lib/ballerina/ballerina-0.981.0"
Save your changes and restart the editor to effect the changes.
In this article we had a look at how to configure VSCode for Ballerina development. In my next article, I’ll give you an introduction about the available development features in Ballerina plugin.