Skip to main content

VS Code - ObjectScript

To use VS Code - ObjectScript, you start by connecting it to an InterSystems IRIS server. You'll associate a VS Code workspace (a folder containing the files you'll work with) with the USER namespace (the same namespace you used with the Terminal). Launch VS Code, and follow these steps to create a new server definition:

  1. In the Activity Bar on the left, click the InterSystems icon at the bottom of the Activity Bar, and then click the Servers view. From here, you can define and browse InterSystems IRIS server connections.

  2. Click the + icon to create a new server definition.

  3. Respond to the following series of prompts that appear at the top of VS Code.

    • Name of new server definition: training

    • Optional description: training instance

    • Hostname or IP address of web server: 127.0.0.1

    • Port of web server: 80. (For versions before v2023.2, enter 52773).

    • Optional path prefix of instance: Enter the name of the IRIS instance.

    • Username: superuser or another valid IRIS username.

    • Connection type: select http

For more information, read Add a New Server Connection ProfileOpens in a new tab.

The server definition you just created is stored in a file called settings.json. If you want to open this file within VS Code, click File > Preferences > Settings > Extensions > InterSystems Server Manager. Then click the Edit in settings.json link.

Next, connect a VS Code Workspace folder to IRIS using your new server definition. Follow these steps:

  1. Create a new folder named Tutorial within \Documents\InterSystems\, select it, and click Select Folder. A TUTORIAL folder now appears in the Explorer.

  2. Click the InterSystems IRIS icon at the bottom of the Activity Bar to display the ObjectScript Explorer, which allows you to connect VS Code to an InterSystems IRIS server and browse the code.

  3. Click Choose Server and Namespace.

  4. Choose the training server you created earlier.

  5. Enter a valid password for your username: possibly SYS.

  6. Choose the USER namespace from the list. The ObjectScript Explorer now shows all the classes and other code contained in the USER namespace on the server.

VS Code - ObjectScript allows you to debug your code following VS Code conventions:

  1. Click to the left of any line in your code to toggle a breakpoint on (red dot appears) or off.

  2. To quickly launch the debugger on any class method, click Debug this method that appears just above the class method name. If the class method takes any arguments, you'll be prompted for to supply them.

  3. You can also define a launch configurationOpens in a new tab by editing the launch.json file. In particular, you use the "program" attribute to specify the class method you want the debugger to launch ("##class(ObjectScript.RightTriangle).Main()", for example), along with any arguments.

FeedbackOpens in a new tab