Written by

Software Architect at Visum
Article Yuri Marx · Dec 16, 2024 2m read

Edit your Globals with VSCode and YAML

The best way to list, edit, save and delete globals is using an IDE. Now, it is possible if you use VSCode. It is also possible to save globals using yaml files. Perform the following steps:

1. Get an InterSystems IRIS instance and install the application iris-global-yaml: 

zpm:USER>install iris-global-yaml

2. If you just to want an InterSystems IRIS trial for tests git clone and run on docker:

git clone https://github.com/yurimarx/iris-global-yaml.git
docker-compose up -d --build

3. Go to https://openexchange.intersystems.com/package/IRIS-Global-VSCode-Editor, click GitHub button, look for iris-global-editor-0.0.1.vsix file, and save it in your local disk.

4. Now, open your VSCode IDE and click extensions:

 

5. Click the button ... and select Install from VSIX...:

 

6. Select the vsix file from your local disk to install (if installation fails, update your VSCode for the most recent VSCode binary and try again):

7. Go to View > Explorer:

8. Create or edit the file .vscode/settings.json with connections settings (edit with your host, port, namespace and credentials):

"conf.irisGlobalEditor.serverconfig": { 
      "host": "http://localhost:52773", 
      "namespace": "USER", 
      "username": "_SYSTEM", 
      "password": "SYS"
}

9. Go to the tab INTERSYSTEMS IRIS GLOBALS and click the button refresh:

10. The VSCode list all globals in the configured namespace:

11. On top of the tab, click the plus button to create a new global:

12. Write the global name and your value and press enter:

13. Click refresh button again and see your new global on bottom:

14. Now click the editor button (last button) to create a yaml file to edit your global:

15. A new yaml file is created with the global content:

16. Edit the yaml to insert subscripts into your global (it is very important use indentation with 4 spaces):

# IRIS-Global-YAMLUSER:^test:     value:InterSystemsIRIS     subscripts:        -^test(1):1        -^test(1,1):1.1        -^test(1,2):1.2        -^test(2,1):2.1        -^test(2,2):2.2        -^test(2,3):2.3        -^test(2,4):2.4

17. Save the file on any project folder and the global content will be saved on IRIS Server:

18. Try the delete buttom also and enjoy!

Comments

Evgeny Shvarov · Dec 16, 2024

Great initiative!

Reading works, but editing and saving doesn't. Created global ^AAA first (in terminal), then read it in VSCode, opened YAML file, edited, saved in /data/gl folder - how can data can be imported to IRIS?

0
Yuri Marx  Dec 16, 2024 to Evgeny Shvarov

the problem is the name of the file, use names without special chars and format the document before.

0
Evgeny Shvarov  Jan 2 to Yuri Marx

But it is the extension that creates a file with such a name, no?

0
Yuri Marx  Dec 18, 2024 to Evgeny Shvarov

Execute format document before and will works, and choose a file name without special chars.

0
Evgeny Shvarov · Dec 16, 2024

Also, it'd be great to open the tab with the YAML file when clicking on Editor.

0
Evgeny Shvarov · Dec 16, 2024

Also it'd be great to search/filter globals in the list, ideally with wildcards, e.g. ^Project*

0
Yuri Marx  Dec 18, 2024 to Evgeny Shvarov

Implemented!

0
Evgeny Shvarov · Dec 16, 2024

It'd be great to include global name into the YAML file name

0
Evgeny Shvarov · Jan 2

How to deal with globals that contain $lb and $bit data?

0