The Ballerina Extension for Visual Studio Code
The Visual Studio Code Ballerina extension provides a set of rich language features along with an enhanced user experience. It offers easy development, execution, debugging, and testing for the Ballerina programming language. The Ballerina language possesses a bidirectional mapping between its syntaxes and the visual representation. You can further visualize the graphical representation of your Ballerina source via the extension.
The extension works across all Ballerina versions, and some of the supported features of the extension may vary from Ballerina version to version.
Download and install Ballerina.
Install Ballerina VS Code Extension. Launch VS Code Quick Open (
Ctrl + P), and paste following
ext install WSO2.ballerina
Open a Ballerina
.bal file or a package directory to activate the extension.
Info: When the extension is activated, you can see the
Ballerina SDK: <version> in the status bar at the bottom left corner.
The VS Code Plugin brings in language support features to provide an improved experience for the Ballerina developer. The below are some of the main features available for ease of development. For more details, see Ballerina Language Support.
- Code Completion
- Signature Help
- Symbol Information on Hover
- Go to Definition and Peek Definition
- Find all References
- Code Actions
- Document Formatting and Range Formatting
The Ballerina VS Code extension adds debugging capabilities for the Ballerina language. It supports debugging with expression evaluation and conditional breakpoints. It also allows you to debug applications remotely.
For more details, see Ballerina Debugging.
Each Ballerina source maps to a sequence diagram with its inherent mapping between the textual and graphical representations. The extension provides a graphical view that helps to visualize your Ballerina source.
For more details, see Diagram View.
AI Data Mapping
The extension is presented with easy data integration capabilities using machine learning (ML) approaches. It generates the mapping for Ballerina record types using a set of trained ML models. These models are trained with a collection of statistical features using rule-based and neural network methodologies.
For more details, see Data Mapping.
VS Code Commands
The Ballerina extension provides a set of Ballerina-specific palette commands for quick reference.
- Build - Builds the project
- Run - Runs the project
- Test - Runs all tests in the project
- Add Module - Adds a project module for a given name
- Show Diagram - Shows the sequence diagram of the current Ballerina file
- Document - Generates documentation for a Ballerina project
To run a specific command, press
Ctrl + Shift + P and then search and select the required command. For more details, see VS Code Commands.
The extension works out of the box. However, there are some additional configurations that let you customize the experience.
For more details, see Ballerina Configurations.
For troubleshooting, see the Ballerina Output. To view the Ballerina output tab, click View, click Output, and select Ballerina from the output list. It provides additional information if the plugin fails to detect a Ballerina distribution.
You can also enable debug logs from the Ballerina extension settings to view any issues arising from the extension features.
Ask for Help
Create Github issues to reach out to us.
By downloading and using the Visual Studio Code Ballerina extension, you agree to the license terms and privacy statement.
The VS Code Ballerina extension uses the following components, which are licensed separately.
- It runs with the support of the Ballerina Language Server, which is a part of the Ballerina language distribution. The Ballerina language is an open-source software that comes under the Apache License.
- It is structured as an extension pack along with the TOML Language Support extension.