Ballerina Development With VSCode

Nadeeshaan Gunasinghe
Ballerina Swan Lake Tech Blog
4 min readNov 4, 2018

--

Focus

In my previous post, I discussed how to setup VSCode for Ballerina Development. During this post, let’s go through various capabilities you have facilitated with VSCode plugin for the development process.

For better clarification, I’ll discuss these in multiple sections as follows.

  1. Language Intelligence
  2. Run and Debug
  3. Run all Tests
  4. Graphical Editor
  5. Documentation Viewer

Language Intelligence

Context-Aware Language Intelligence

Today we heavily depend on various IDE/ Editor plugins when it comes to programming/ development. For an example, if a developer is working on a new language or framework, an editor with the intelligence with the particular language/ framework can enhance the development experience as well as increase the efficiency.

Ballerina VScode plugin provides the language intelligence with a Language Server implementation. This particular implementation comes with a number of Language Intelligence options such as,

  • Semantic and Syntactic Diagnostics
  • Code Completion and suggestions
  • Refactoring options
  • Go to Definition

There are many other features to explore under language intelligence and you can refer to the currently available options with a detailed description in below article

Ballerina VSCode Plugin — Language Intelligence

Run and Debug

You can easily run or debug your Ballerina Programs in VSCode by Launching the debugger. Conventional VSCode Debugger has been coupled to Ballerina Debugging and you can achieve the same debugging experience with Ballerina plugin as well. Follow the below steps to start a debug session (Same applies for the run option as well).

  • Hit ctrl + shift + D and go to the debugger view
  • Add debug points
  • Select Add Configuration and then Select the Ballerina Debug Option
  • Start Debugging
Start a Ballerina Debug Session

For more information on VSCode Debugging, refer here.

Run all Tests

Run all Tests option allows you to run all the tests within your project. This will run all the tests even within multiple modules in the same project.

Run all Tests in the Project

Graphical Editor

Ballerina Graphical Editor

When it comes to the integration space, the development process can be heavily benefited by a rich set of tools. Among these tools, visualization tools play a major role. Visualization of parallelism, interaction with external endpoints and data flow are such major focused areas. When it comes to Ballerina, you can visualize your code in a sequence diagrammatic manner, showing the interactions and parallel invocations in the code. Ballerina VSCode plugin ships with a graphical editor not only to visualize your code as a diagram but also it allows you to design your integration scenario graphically. Read bellow article on how to use the Ballerina Graphical Editor and to explore the capabilities available.

Ballerina VSCode Plugin — Graphical Editor for Ballerina

Documentation Viewer

Documentation Viewer is another cool feature which is shipped with the Ballerina plugin. Consider plugin you are writing and you add the documentations for the functions and other public entities for the sake of third-party users. Ballerina’s Documentation Viewer represents the documented entities in a file in an organized manner. You can launch the Documentation Viewer with the Ballerina: Open Doc Preview command.

Launch and Explore Doc Preview

During this post, I have described the available features and capabilities of Ballerina VSCode plugin. I’ll be continuously updating this post with the latest features (there are lot to come :D ) and if you enjoy using the plugin please don’t be hesitate to give your feedback here as well.

Also, if you find any issues or you have any feature requests, we are always open for the suggestions. Go to our Github repo and create an issue :)

Dance Merrily with Ballerina…

--

--

Nadeeshaan Gunasinghe
Ballerina Swan Lake Tech Blog

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