Have you ever been editing files in VS Code, but needed to check a global value or run a few ObjectScript commands? Now you can, with no setup required! If you have vscode-objectscript extension version 2.10.0 or later and are connected to InterSystems IRIS 2023.2 or later, you can now open a terminal connection to your server, regardless of where it's located.
There are three ways to open this new terminal:
-
The "Launch WebSocket Terminal" command in the command palette (Ctrl-Shift-P on Windows, Cmd-Shift-P on Mac):
-
The VS Code integrated terminal's Profiles menu:
-
The Server Manager extension's server tree:
The WebSocket Terminal supports many of the features of the standard ObjectScript shell like reads, namespace switches, interrupts and custom terminal prompts. However, in this post I'd like to highlight three features that are unique to it.
-
Command input is syntax colored, so you can be sure that your input is syntactically correct before running:
-
The terminal supports a multi-line editing mode, where a new line will be added upon pressing Enter instead of running the input. A new line will be added if there are unclosed left brace { or left parenthesis ( in the command input:
-
It's fully integrated with VS Code's shell integration, so VS Code captures command input and output. This allows you to easily re-run commands and copy command output to the clipboard without having to highlight text with your cursor:
For a full list of features, see the official documentation. Have an idea for how we can improve this feature? We're happy to hear it! Post your suggestions on the extension's GitHub repository. All screenshots in this post use the new "InterSystems Default Dark Modern" VS Code theme, which is available in the InterSystems Language Server extension version 2.4.0 and later.
Thanks @Brett Saviano
This is very useful and it works with IRIS 2023.3, without Private Web Server (removed from IRIS 2023.2)
💡 This article is considered as InterSystems Data Platform Best Practice.
Just a note that this has been renamed to InterSystems lite terminal
When I try to launch Lite terminal from VScode (I tried all approaches above and got the same error), I got this error:
WebSocket error: Error: Unexpected server response: 101
Anyone knows how to resolve this? I can connect to my instance fine, and open/edit code from the namespaces, just the websocket for lite terminal isn't working properly. Thanks!
Maybe the web server that you are connecting to IRIS through isn't configured to allow the WebSocket protocol. For IIS there's some relevant documentation at https://docs.intersystems.com/iris20243/csp/docbook/DocBook.UI.Page.cls?...
Also https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cls...
Thank you very much John! I am indeed using IIS for my local instances so that's the reason here.