How can I use SPLIT SCREEN with VS-Code?

If you are like me and spend your days wrangling RPG, CL, or SQL code on your IBM i system, you know how handy it is to juggle multiple files at once. Maybe you need to compare a source member in one library to another or keep an eye on a DDS file while tweaking your RPGLE program. Visual Studio Code, or VS Code, makes this a breeze with its split screen feature. It is not some fancy IBM i specific trick, it is built right into VS Code, and it works seamlessly with extensions like Code for IBM i. In this quick lesson, we will walk through how to set it up and use it to boost your productivity. No more flipping tabs like a mad person, let us get your workspace split and conquer.

First off, what is split screen? It lets you divide your editor window into multiple panes, each showing a different file or even different parts of the same file. Think of it as having two or more editors side by side in one window. For IBM i devs, this is gold when you are connected via SSH to your system, browsing libraries, and editing members. You can have your RPG source on the left and any other related program on the right or split vertically to scroll through long procedures independently.

vs-code using split screen for IBM-i source code edit

One of my favorite things is the ability to open the exact same source code in split screen - so i can be editing one area on side and searching, moving around and even editing other sections of the same program in the other pane!

To get started, make sure you have VS Code installed and the Code for IBM i extension up and running. Connect to your IBM i box as usual, open a workspace, and load some files from your libraries. Now, to split the screen, you have a few easy ways:

  • Keyboard shortcut: With a file open, hit Ctrl+\ (that's Control and backslash) on Windows or Linux, or Cmd+\ on Mac. This splits the current editor vertically into two groups. Boom, instant side by side.
  • Menu navigation: Go to View > Editor Layout > Split Right for a vertical split, or Split Down for horizontal. You can also right click on a file tab and choose Split Right or Split Down.
  • Drag and drop: Open multiple files, then drag a tab from the top bar to the right or bottom edge of the editor area. VS Code will highlight where the new pane will land. Drop it, and you are split.

Once split, each pane acts like its own editor. You can open different IBM i source members in each, use autocomplete or even run commands from the integrated terminal in one while editing in another. Navigation is simple: Click into a pane to activate it, or use Ctrl+1, Ctrl+2, etc., to jump between groups (the numbers correspond to the group order).

For IBM i specific tips, leverage the extension's object browser in one pane while editing in the other. Say you are modernizing legacy code, split to compare fixed format RPG on one side with free format on the other. Or, keep your SQL script visible while debugging a related program. If you need more than two splits, repeat the process, VS Code supports up to a grid layout if you go wild with it.

vs-code using split screen with 4 source

Customization is key in VS Code. Head to Settings (Ctrl+,) and search for "editor.split" to tweak behaviors, like whether new splits open to the right or below by default. For performance on IBM i remote connections, keep your workspace lean to avoid lag when switching panes.

One pro tip: If you are in a split and want to merge back, right click the tab and select Join All Editor Groups, or use View > Editor Layout > Single. It keeps your workflow flexible.

In summary, split screen in VS Code is a straightforward powerhouse for IBM i programming. It cuts down on context switching and lets you see the big picture without extra windows cluttering your desktop. Give it a try next time you are knee deep in source members, and you will wonder how you coded without it.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>