InterSystems ObjectScript extension for VS Code
InterSystems® ObjectScript language support for Visual Studio Code, from the InterSystems Developer Community.
Documentation on GitHub Pages.
InterSystems ObjectScript code highlighting support.
Debugging ObjectScript code.
Intellisense support for commands, system functions, and class members.
Export existing server sources to the working directory: open Command Palette (F1 or Cmd/Ctrl+Shift+P), start typing 'ObjectScript', choose
ObjectScript: Export Sources, press Enter.
Save and compile a class: press Ctrl+F7 (⌘+F7) or select
ObjectScript: Import and Compile Current File from Command Palette.
Direct access to edit or view server code in VS Code Explorer via
isfs-readonly FileSystemProviders (e.g. using a multi-root workspace).
Server Explorer view (ObjectScript: Explorer) with ability to export items to working directory.
Install Visual Studio Code first.
Open VS Code. Go to Extensions view (Cmd/Ctrl+Shift+X) and search for "vscode-objectscript" and install it.
Or install from the ObjectScript extension page on Visual Studio Marketplace
To be able to use many features you first need to configure the connection to your IRIS/Caché/Ensemble server(s) in your VS Code settings. If you are unfamiliar with how settings work and how they are edited, use that link.
We recommend you define server connections in the
intersystems.servers object whose structure is defined by the InterSystems Server Manager helper extension. Install this extension and consult its README about commands for easy setup of connections, plus assistance when editing the JSON definition. For example:
"description": "My local IRIS",
By defining connections in your User Settings they become available for use by any workspace you open in VS Code. Alternatively, define them in workspace-specific settings.
username property is optional. If omitted it will be prompted for when connecting, then cached for the session.
Setting a plaintext value for the
password property is not recommended. Instead, run the
InterSystems Server Manager: Store Password in Keychain command from Command Palette.
If no password has been set or stored it will be prompted for when connecting, then cached for the session.
A workspace consisting of a local working directory in which you edit InterSystems source files and manage them using client-side source control (e.g. Git) will use the
objectscript.conn settings object to access the server for export (compile) and debug, and also for import. This is usually defined in Workspace Settings, for example in the
.vscode/settings.json file of your working directory.
We recommend that
objectscript.conn uses its
server property to point to an entry in
intersystems.servers. For example:
ns property defines which server namespace you will work with.
server property is set, any
password properties of
objectscript.conn are ignored. Instead these values come from the
To edit code directly in one or more namespaces on one or more servers (local or remote) we recommend creating a workspace definition file (for example XYZ.code-workspace) where you specify one or more root folders that directly access namespaces via the
isfs-readonly URI schemes. The only difference between these two schemes is that any file opened from a folder using the
isfs-readonly scheme will be set as readonly in VS Code and thus protected against changing.
- Start VS Code.
- If your last-used folder opens, use 'Close Folder' on the 'File' menu ('Code' menu on macOS). Or if what opened was your last-used workspace, use 'Close Workspace'.
- On VS Code's Explorer view, click the 'Choose Server and Namespace' button. Respond to the sequence of quickpicks. You can also define a new server connection during this process.
- Use 'Save Workspace As...' to store your workspace definition in a file with a
To access the server-side files of a web application, edit the JSON of your workspace definition. Get there by running the 'Preferences: Open Workspace Settings (JSON)' command. Format your
uri property like this example for the
/csp/user web application:
csp query parameter indicates web application files are to be shown. The uri path specifies which application. The
ns parameter must specify the same namespace the application is configured to use.
To see only classes in the X.Y package, format the uri like this:
Other query parameters that can be specified:
type=cls to show only classes, or
type=rtn to show only routines.
flat=1 to flatten the hierarchy.
generated=1 to show generated items.
filter=filterspec to use a filter specification formatted in the same way as used in InterSystems Studio's File Open dialog (e.g.
Connection-related output appears in the "Output" view while switched to the "ObjectScript" channel using the drop-down menu on the view titlebar.
For Caché/IRIS instance with maximum security level, add
%Development role for
/api/atelier/ web-application (read more).
If you are getting
ERROR [#5540](https://github.com/intersystems-community/vscode-objectscript/issues/5540): SQLCODE: -99 Message: User xxx is not privileged for the operation when you try to get/refresh class/routine/includes lists, grant your username (or a SQL role you hold) execute permission for the following SQL Procedure in the target namespace.
GRANT EXECUTE ON %Library.RoutineMgr_StudioOpenDialog TO xxx
Support and Training
CaretDev provides commercial support services. Request a quote.
On-line course from CaretDev - Developing with VS Code ObjectScript – Easy Start.