Update: Code for IBM i Language Tools
Code for IBM i and its RPGLE language tools have come a long way! I am excited to share some of the language tools improvements with you today. They are absolutely worth talking about. Language tools are what makes writing code fun and exciting, and we can be better developers with them.
For this article I am using:
- Code for IBM i: Used to connect to the IBM i, write and compile code, plus much more!
- RPGLE language tools: Adds all of the neat language features to VS Code.
New support for fixed format RPGLE
As an IBM i developer, you will probably need to work with older, fixed format RPG at some point. When you do, you’ll want to do it from within Code for i, so we started adding fixed format support about a month ago. For each feature discussed below, I’ve indicated if it currently handles fixed format.
Outline view
Shows all definitions, including file definitions. A very simply concept. Clicking on the item will take the user to the line of code where it is defined. Read more about the outline view in the VS Code documentation.
Works for:
- Fixed format RPGLE
- Mixed fixed/free RPGLE
- Total free format RPGLE
Content assist
Provides content assist for all definitions (including data structure subfields.) As you type code, you may not remember what variable you need, or perhaps you want a glance at how a variable is defined: the content assist can help you do that.
Works for:
- Fixed format RPGLE
- Mixed fixed/free RPGLE
- Total free format RPGLE
Peek & go to definition
Peek and go to definition is my favourite feature of all time (especially peek!) It can quickly show you, or take you, to where the chosen variables, struct, etc. is defined. I love peek because it opens the file up in line (as in the image below.)
Works for:
- Fixed format RPGLE
- Mixed fixed/free RPGLE
- Total free format RPGLE
Peek references
A simple and effective feature that shows where instances of a variable are used.
Works for total free-format RPGLE.
Linter
The linter can do so much to make sure your developers are writing clean code. In the screenshot below, you can see the linter is showing that I’ve used the same string literal many times over. It also provides a quick fix, and can easily refactor them into a constant. You can read more about the linter on a previous post about it.
The linter works for total free-format RPGLE.
Final words
There are so many things you can do with VS Code to make writing RPGLE an absolute breeze. While this is the end of this post, it’s not the end of functionality. I also recommend that you try the fixed-format outline view found in the RPGLE language tools settings, as well as checking out the RPGLE Free extension.
For more information on Code for i, see Visual Studio Code for IBM i: A Resource Guide.
Leave a Reply
Want to join the discussion?Feel free to contribute!