Setting Up VSCode for Ballerina Development in 60 Seconds

Nadeeshaan Gunasinghe
Ballerina Swan Lake Tech Blog
2 min readSep 7, 2018

--

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
command palatte

Install from Market Place (From Editor)

Search market place

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.

Invalid ballerina home

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.

--

--

Nadeeshaan Gunasinghe
Ballerina Swan Lake Tech Blog

Autor, Technical Lead at WSO2, Microservices Enthusiast, Full-stack Developer, Hardcore Cricket Fan, Sci-fi Addict ;)