VS Code Provides Another Coding Option for IBM i
December 9, 2020 Alex Woodie
IBM i shops that are looking for an alternative to IBM’s Rational Developer for IBM i (RDi) may want to check out a lightweight code editor from Microsoft called Visual Studio Code (VS Code). Thanks to extensions for IBM i languages developed by the opensource community, VS Code can support native development in RPG, CL, and SQL.
First released by Microsoft in 2015, VS Code provides a basic environment for writing and editing code. It features debugging, syntax highlighting, intelligent code completion, snippets, and code refactoring, as well as embedded Git. It runs on Windows, Linux, and Mac, and while it shares a name with the full-featured Visual Studio integrated development environment (IDE), VS Code is really its own thing.
For starters, there is Niels Liisberg’s RPG extension, which supports reading and writing free format ILE RPG. There is also the IBM i Languages extension, which brings additional versions of RPG (including RPGIII, RPG/400, RPGLE, free format RPG), as well as CL, DDS, and SQL, to the VS Code party (although the author, Barret Otte, states it is intended only for reading, not writing, code). Both extensions have received positive reviews.
Anand Khekale is an IBM i consultant based in Pune, India, who has found VS Code quite useful for working on IBM i. Khekale says he started using VS Code to work on open source languages like Node.JS and Python, but when he stumbled upon a few extensions like SSH-FS, he realized he could write code directly on the IBM i.
“This led me to search extensions for native IBM i languages such as CL, RPG, RPGLE, COBOL and from there I fell in love with how easy it is to work in VS Code, even if I want to work on native languages,” Khekale tells IT Jungle via email. “Because of the vast ecosystem that this editor brings (extensions, themes, fonts, etc.), it becomes easy to write code for both open-source and native languages.”
In particular, Khekale is particularly smitten with snippets, which is a VS Code feature that allows a developer to create a shortcut for blocks of code that are frequently written. With just a couple of keystrokes, a developer can quickly call up pre-written chunks of code and have them automatically populated on the screen.
“With snippets, it becomes fast and joyful to write code,” he recently wrote in a blog post. “You just have to use the shortcut and press the Tab key or the Enter key, and the code gets generated for you.”
Git integration is another positive for VS Code. “Its integration with version management tools like Git with extensions like GitLense gives you real-time information on which line of code was changed by whom and when,” Khekale writes.
In his blog post, Khekale details how he works with VS Code in an IBM i environment. A key element of enabling VS Code to work with IBM i is getting SSH-FS up and running on the IBM i server. A 2014 IT Jungle tutorial by Aaron Bartell (who also contributed to Liisberg’s RPG extension but, alas, is out of the IBM i racket, last we heard) proved helpful to Khekale for getting SSH up and running on IBM i.
VS Code will be another tool in his toolbelt, Khekale says. “I will be using it for consulting engagements and have partially started in my current projects,” he writes. “I use it to go through code while I am analyzing it. The syntax highlighting, variable highlighting (when you click on a variable, it displays each occurrence of it in the whole program) helps speed up debug and analysis of old programs.”
His current consulting client has not moved into free form RPG yet. “Otherwise,” he adds, “this is the tool to go, given they don’t use RDi.”
While languages like Node.js and Python seem to be rising in popularity among IBM i developers, for many, there is no replacing native languages like RPG. For those organizations that can’t, or refuse, to use IBM’s full-featured RDi, products like VS Code can certainly play a role.
“The code editor is so lightweight, very easy to customize to your liking (themes, fonts, etc),” Khekale writes. “There are still many IBM i shops which cannot afford other editors and are thinking about modernizing their applications. For bringing new talent on the platform, the familiarity and comfort they feel while working with the editor, and the integration this editor brings, gives it an advantage.”