VS Code Commands

The VS Code Ballerina extension comprises a set of palette commands to enable easy development using the inherent capabilities of the Ballerina language.

Tip: Click View in the menu bar of the editor and click Command Palette to access the command palette. Alternatively, use the VS Code palette shortcut (⌘ + ↑ + P on Mac and Ctrl + Shift + P on Windows and Linux) to execute the commands.

Show Examples

It lists the available examples of the Ballerina language. By clicking on each example, you can explore each source code.

Show Examples

Tip: If you encounter any errors, check the Ballerina Home configuration.

Build

It is a quick access to build your Ballerina project. Once executed, the current Ballerina project relative to the currently-opened text editor is built using the bal build CLI command.

Build

Run

It runs your Ballerina project. Once executed, the opened Ballerina project is built using the bal run CLI command.

Run

Tip: If you use any configurable variables, the relevant Config.toml file should be added inside the Ballerina project root in case the BAL_CONFIG_FILES and BAL_CONFIG_DATA environment variables are not defined.

Test

It runs all the tests in your Ballerina project using the bal test CLI command.

Test

Tip: If you use any configurable variables, the relevant Config.toml file should be added inside the corresponding module’s test directory root.

Build Documentation

It is a quick guide to generate documentation for your Ballerina project. Once executed, the documentation is generated using the bal doc CLI command. The generated documentation can be found inside the apidocs directory in the project target.

Document

Show Diagram

It is a palette reference to access the Diagrams view. On execution, the diagram editor of the first diagram component listed under the Diagrams view is rendered.

Show Diagram

Add Module

It adds a Ballerina module for the given module name using the bal add CLI command.

Add Module

Create ‘Cloud.toml’

It generates a Cloud.toml file for your Ballerina project according to the default cloud specifications.

Create Cloud.toml

Paste JSON as Record

This command converts a JSON string (that is copied to the clipboard) to a Ballerina record(s) and pastes it in your code.

Paste JSON as Record