A great IDE contains features that increase your coding speed and accuracy so you can focus on your program’s logic. One of my favorite productivity enhancers, content assist, has been bundled in Visual Studio Code for IBM i since its inception. Content assist gives you autocomplete options for code as you write it, reducing syntax errors.
Today we’re announcing a new killer productivity tool for Code for IBM i—a built-in linter!
A linter is a static code analysis tool used to flag programming errors, bugs, stylistic errors and suspicious constructs. It’s like a giant lint roller, but one that captures sloppy code rather than cat hairs. Some linters already existed for RPGLE, like rpglelint, which was a big inspiration for this extension feature.
Our linter has lint options for:
- Indentation, which is detected automatically by VS Code
- Requiring brackets around
WHEN, etc. operations
- Making sure variable references match the way they are defined
- So much more!
The new RPGLE Language Tools extension
With the addition of linting to content assist and other Code for IBM i language tools, we decided to move all the VS Code for IBM i language tools into an optional extension with its own code base. This made sense for many reasons, including the size of the code base required to parse RPGLE source.
So, as of just a few days ago, you can now download the new RPGLE language tools extension (codename vscode-rpgle) from the Visual Studio Code Marketplace. The extension adds a magnitude of functionality for writing free-format RPGLE, such as:
- Content assist
- Outline view
- Fixed format column assist
- and now . . . linting!
Getting started with RPGLE linting
The RPGLE language tools extension depends on Code for IBM i to access source code from
/include statements, so make sure you have already installed Code for IBM i. From there:
- Install RPGLE language tools from the Marketplace
- Open the VS Code settings (Control / Command + Comma)
- Search for
vscode-rpgleand enable Linter Support
- Connect to your IBM i using Code for IBM i
- Right click on a library filter and select ‘Open RPGLE lint configuration’
If the lint configuration doesn’t exist, it will prompt you to create one. This feature will create a source file called
vscode in the chosen library, and
rpglint.json inside of that source file. It will be created with some default options turned on. This is not an opinionated linter, but we default with the most useful ones enabled.
From there, you can open any
**FREE RPGLE source code and expect the linter to do the job!