Question
· Aug 27, 2019

How to Export ObjectScript From IRIS Server With VSCode?

Hi Developers!

A question to those who use VSCode to code InterSystems ObjectScript.

Suppose you have the ObjectScript code on IRIS server and you want to export it into the desired folder.

And you have VSCode connected to the server.

What is the way to tell VSCode that I want to export classes into some particular folder in /package/class.cls way?

E.g. into:

/project_folder/src/cls/Package/class.cls

and project_folder is opened in VSCode as the folder of the project.

Discussion (8)3
Log in or sign up to continue

There is an option in the settings: "objectscript.export.addCategory",  when it's set to true, it will add categories for different file types.

In uppercase CLS for files "cls",  and RTN for "int", "mac", "inc".

The next coming version will support the way to have more control over it, where the left side for extension of a file, and the right part for a category name

"objectscript.export.addCategory": {
  "cls": "_cls",
  "mac": "_mac",
  "int": "_int",
  "inc": "_inc"
}

Hi Marcel, yes, something was implemented, which may help you with it. There is a new item map in objectscript.export. For instance this

   "objectscript.export": {
    "folder": "",
    "addCategory": false,
    "map": {
      "%(.*)\\.([^.]*)": "src/$2/_$1.$2",
      "(Test\\.PM\\.Integration\\..*)": "tests/integration_tests/$1",
      "(Test\\.PM\\.Unit\\..*)": "tests/unit_tests/$1",
    },
  }

I have on the same level src and tests folders, so, I set folder to an empty string, to operate on a root level. My Unit Test classes, just placed in the desired folder without adding the folder by type (e.g. cls, inc). But, any other sources have to be stored by type in a separate folder, and my classes are a percent classes, and I have to replace % to _.

On the left side, I have the regular expression to match any main classes %(.*)\\.([^.]*) it should match the filename completely, and on the right side replacement. Same you can see for two different types of UnitTests.