Open Exchange App VSCode ObjectScript release 0.7.13

Hi all, it's finally time for the next release of VSCode ObjectScript extension. So what's new in this release.

  • Debugging support, for classes, routines and attach to a running process
  • Files in Server Explorer now can be edited

  • Added more details about connection errors

  • Improvements in Server Explorer build tree

  • Fixed memory leak when exporting large amount of files
  • Server view can be opened in explorer as virtual file system with schema `isfs://`
  • Option to suppress popup information message about successful compile, ("objectscript.suppressCompileMessages": true)
  • Export, addCategory setting have more flexibility in naming category for exported items
  • Formatting for commands and functions, as Word, UPPER or lower
  • Some improvements in syntax highlighting
  • Some other small fixes

Well, let's go to details.

Debugging

It is now possible to debug running ObjectScript code with VSCode-ObjectScript extension. You just have to fill .vscode/launch.json file with content similar to this.

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [    
    {
      "type": "objectscript",
      "request": "launch",
      "name": "ObjectScript Debug Class",
      "program": "##class(User.Test).Test()",
    },
    {
      "type": "objectscript",
      "request": "launch",
      "name": "ObjectScript Debug Routine",
      "program": "^test",
    },
    {
      "type": "objectscript",
      "request": "attach",
      "name": "ObjectScript Attach",
      "processId": "${command:PickProcess}",
      "system": true
    }
  ]

}

Let's debug some routine. You may notice here, that debug console shows all output happen during the run. Local and global variables visible there, as well as stack.

Next, go with debugging some class. As you may notice here, it is also possible to evaluate any ObjectScript expressions (variables, functions and so on) in the debug console, or in watch panel. Break command also stops running, of course.

You can also connect to any running process, just after connect it stops, and after continuing it returns control back to the process.

VSCode-ObjectScript debugger utilize Atelier debugger API, so, you don't need to install anything on your server, just connect to any Caché or IRIS with version (2016.1+) which supports Atelier.

Formatting

Previously when you vscode suggested commands and functions it was instead than in UPPERCASE only. Now you can select, the way you prefer more. There are three options, upper, lower and word

"objectscript.format": {
  "commandCase": "word",
  "functionCase": "word"
},

You can see how it works below.

VSCode itself has formatting support by Meta/Alt+Shift+F. And it can format code by some configured rules. Currently, it can replace short commands/functions to complete name, and set case as above. And it can fix indention in case if was used spaces.

Edit on server

Some of the developers who just in the process of moving to the new way of storing sources and using VSCode, may find the possibility to edit files directly on the server very useful. And if you have Studio Control class, which used to export sources,  it will work in VSCode-ObjectScript as well.

In VSCode you can configure projectname.code-workspace file, with content like this

{
    "folders": [
        {
            "name": "temp",
            "path": "."
        },
        {
            "name": "server",
            "uri": "isfs://temp"
        }
    ],
    "settings": {
    "objectscript.export": {
      "folder": "src",
      "addCategory": true,
    },
        "objectscript.format": {
            "commandCase": "word",
            "functionCase": "word"
        },
    }
}

When you open such workspace file in VSCode, you will get multi-root environment. With two root folders temp and server, where temp will follow to the root of the folder where you created code-workspace file, and server which will show sources directly from server configured in this project. You will be able to edit code directly on the server, but your changes will not be stored locally unless you have configured Studio Source Control class, exactly the same way as in Studio.

You can also set setting "objectscript.serverSideEditing": true to available to edit classes/rountines right from explorer view.

Export

If in your company you have some convention how to store sources in repository, you may find this feature useful. Setting "objectscript.export.addCategory" got some improvement with the latest version. Previously if you would set it to true, it was exported any classes to CLS folder, mac, inc and int to RTN folder. With this release you may setup a configuration like following below, if looking at the left side, for a regular expression, or just a file extension, and right side for a folder name

{
  "objectscript.export": {
    "addCategory": {
      "%.*\.cls": "_cls",
      "cls": "cls",
      "mac": "mac",
      "int": "rtn",
      "inc": null
    }
  }
}

 

Enterprise support

Recently we have started our own company CaretDev, which offers enterprise commercial support for VSCode-ObjectScript extension for companies which would like to introduce VSCode ObjectScript IDE in their software development process with InterSystems data platforms. We have also plans for individual developers, just contact us. But the extension itself is still free to use.


Also, check the previous part VSCode-ObjectScript release 0.7.11

Comments

Outstanding! @Dmitry Maslennikov 

I bought you some coffe to celebrate your doings, keep the good work!

Now one question, do you think you could add an option to disable the auto-save? I'm thinking on using my extension to complement yours regarding the support for projects. It's not release yet but I plan on doing it very soon.

Rubens, thanks for the donation. 

You can just disable a connection with "objectscript.conn.action": false, and activity with a server will be disabled,  autosave as well.

Actually I had this option previously but removed it recently. If you would like to have this option, just fill the issue, I will add it.

It's cool, that more and more extensions will appear, to add more features. 

btw, are you going to GlobalSummit, so we would have some discuss there?

Sadly, I'm not planning to participate this GlobalSummit due to travel wages and passport issuing time.

But we can keep the discussions going by message for now if you want.

Also regarding the option you mentioned, this also disables your Atelier IntelliSense integration, could you think of a way to separate the IntelliSense from that option? I tested it and only the local IntelliSense remains.

Sure, we can discuss here, or in github

Yes, some IntelliSense options need connection to the server, yet for now. Like, it's easier yet to get a list of methods directly from server, instead of parsing all files locally. But some things, such as commands and system functions should work without a connection. As well as go to definition if file exists locally. It is possible to add loading METADATA info prepared for Atelier, to use it as a cache for system classes, but it anyway will need a connection to a server at least once.

Yes, I'm not having problems with your extension connected to the server, instead I actually think is the best way since most of the data depends on the server already.

The problem is that the save event is also being called on my extension, which makes the code to be sent two times to the Caché instance.