The VS Code Ballerina plugin brings in language intelligence to enhance the development experience and increase its efficiency.
Language intelligence is built in to the plugin via a Language Server implementation, which consists of the below language intelligence options.
Semantic and syntactic diagnostics
When there are syntax or semantic errors in your code, you will be notified with appropriate diagnostics during the development time.
Tip: The detailed description that appears when you hover over the lines underlined in red will be consistent with the error message that you get during compile-time.
Suggestions and auto completion
The plugin provides you with suggestions on keywords, variables, and code snippets of language constructs (such as functions, services, and iterable constructs etc.).
Tip: You can use these suggestions to access the contents of the modules available in your Ballerina home repo as well as in the Ballerina distribution.
These allow you to perform the below tasks easily based on the diagnostics and the current scope where the cursor resides.
- Add documentation for an entity such as a function, service, resource, object, record etc.
- Add documentation for all the available entities in the current file
- Add missing imports
- Create variable definitions
- Create an undefined function
For example, you can add documentation for a function as shown below.
Hover support provides you quick access to information about a certain entity.
For an example, if you hover over a function name, you can view its description, information about its parameters, and the description of its return type as shown below.
Tip: Likewise, if you hover over an entity name of an object or a record, you can view the description of the object/record as well as descriptions of its fields.
Above are the lanugage intelligence features that are currently available in the Ballerina VS Code Plugin.