This toolkit introduces the capability to investigate and delve in to the syntax trees of Ballerina code and to retrieve the syntax API calls that are required to create a particular piece of Ballerina code. However, this extension only provides additional capabilities to support Ballerina developers. In order to experience language intelligence and other core features, install the Ballerina extension. Checkout the Visual Studio Marketplace for further details.
Before getting started, make sure you have installed the Visual Studio Code editor.
Follow the steps below to install the Ballerina Compiler Toolkit extension.
- Download and install Ballerina.
- Install the Ballerina Extension.
Tip: Alternatively, click
Ctrl + P
or (Cmd + P
in macOS) to launch the VS Code Quick Open screen, and enterext install WSO2.ballerina
to install the Ballerina VS Code Extension.
- Install the Ballerina Compiler Toolkit Extension from the VSCode marketplace.
Tip: Similarly, you can launch the VS Code Quick Open screen, and enter
ext install ballerina.ballerinacompilertoolkit
to install the Compiler Toolkit Extension.
- Open a Ballerina
.bal
file to activate the extension.
The Ballerina Compiler Toolkit includes the capabilities to generate the syntax tree for a given Ballerina source code, using which developers can retrieve a simplified representation of their code blocks for convenient analysis.
- Generate the
complete syntax tree
of a Ballerina source file - Generate the
subtree of the syntax tree
for a particular block of code Locate a code segment
on the complete syntax tree
Representations
The syntax tree visualizer has two types of representations: graphical
and dropdown
.
![](docs/syntax-tree-visualizer/GraphicalTree.jpeg)
![](docs/syntax-tree-visualizer/DropdownTree.jpeg)
Basic Usage
The command for the full syntax tree
retrieval can be found on the Command Palette.
Tip: The command palette can be viewed via
Ctrl + Shift + P
or (Cmd + Shift + P
in macOS).
![](docs/syntax-tree-visualizer/CommandPalette.gif)
The sub syntax tree retrieval
and locate code
options can be found as Code Actions.
![](docs/syntax-tree-visualizer/CodeActions.gif)
Features
The syntax trees rendered through the visualizer have muliple features available in both the graphical and dropdown representations.
![](docs/syntax-tree-visualizer/NodeDetails.gif)
![](docs/syntax-tree-visualizer/Diagnostics.gif)
![](docs/syntax-tree-visualizer/LocateCode.gif)
![](docs/syntax-tree-visualizer/SwitchFullTree.gif)
The Ballerina syntax API quoter lists the API calls required to create the syntax tree for a given Ballerina source code. Hence, its capabilities can be leveraged by any developer who uses the Ballerina syntax API to create source code elements.
Basic Usage
The command for the syntax API quoter can be found on the Command Palette as well. Executing this command will copy the list of syntax API calls that are required by the Ballerina source code, to the clipboard.
![](docs/syntax-api-quoter/CommandPalette.gif)
Create Github issues to reach out to us.