Using the IntelliJ Ballerina Plugin
Click the links below to start using the IntelliJ Ballerina plugin after installing it.
- Creating a new Ballerina project
- Setting up Ballerina SDK for an existing project
- Creating a new Ballerina file
- Configuring the plugin settings
Creating a new Ballerina project
Follow the steps below to create a new Ballerina project.
Open IntelliJ, click File in the top menu, click New, and then click Project.
Select Ballerina as the type of the project, and click Next.
Select a Ballerina SDK for the project, and click Next.
Tip: If you do not have an already-configured Ballerina SDK to select, click Configure, select the location of the Ballerina distribution, click Open, and then click Next to continue with the project creation. However, if you do not configure, the plugin will auto detect the Ballerina Home by executing the
Enter a name for the project, a location to save it, and click Finish.
Now, you have successfully created a new Ballerina project.
Setting up Ballerina SDK for an existing project
- Open the Project to which you want to set up a Ballerina SDK.
In the IDE, click File in the top menu, and then click Project Structure.
3. If you do not have an already-configured Ballerina SDK, in the Project tab, click New under Project SDK:, click Ballerina SDK, and then click OK.
Tip: If you have already-configured Ballerina SDKs, select one under Project SDK:, and click OK to continue.
4. Select the location of the Ballerina distribution and click Open.
5. Click Apply to save the changes.
Tip This prompts a restart request. Click Restart to apply the changes.
Now, you have successfully added the Ballerina SDK to an existing project.
Creating a new Ballerina file
Follow the steps below to create a new Ballerina file within a Ballerina project.
Right-click on the name of the project, click New, and then click Ballerina File.
Enter a name for the file, and click OK.
Tip: In this example, since the default Main template is selected as the Kind, it creates a new file with a main function.
Now, you have successfully created a new Ballerina file with a main function.
Configuring the plugin settings
Ballerina Home auto detection
In order to automatically detect the Ballerina Home that is being used (without setting up a Ballerina SDK), enable the Settings -> Languages and Frameworks -> Ballerina -> Ballerina Home Auto Detection option.
Ballerina Language Specification supports a set of experimental features such as transactions syntax. In order to be compatible with the experimental features and for supporting language intelligence in IntelliJ plugin, enable the Allow Experimental option in Settings -> Languages and Frameworks -> Ballerina -> Experimental Features.
Language Server Debug logs
In order to view the plugin debug logs, enable the Settings -> Languages and Frameworks -> Ballerina -> Language Server Debug Logs option.
Then, the language server debug logs will be added to the IDEA log files. (Click Help -> Show Log In Files option to view them).
Next, for information on using the features of the IntelliJ Ballerina plugin, see Using the IntelliJ plugin features.