DEV Community

InterSystems Developer for InterSystems

Posted on • Originally published at community.intersystems.com

Comfortable VSCode Auto Save and ObjectScript CompileOnSave settings

Hi - Recently I have been investigating an annoying situation whilst editing ObjectScript classes or routines in VSCode.

What was happening to me was, as I was typing in lines of code into my class (for example, adding a new Method, or changing the Class signature, or a block of code),  this would quickly get syntax checked, re-formatted, and compiled - inevitably, (since I would be mid-way through my typing), this would generate compilation errors.

Image description

Knowing that I was mid-way through adding code, I could simply dismiss this message, however, this soon got very annoying, and conditioned me to ignore the error (which is not a good thing).

Even worse, however, is that the compilation process also reformatted the document and sometimes broke what was previously well formatted lines of code (appearing below the line I was writing) - which required me to go into that area of the document and fix them back up.

What's going on ?

There are two settings at play here:

  1. VSCode's auto-save (files.autosave) settings which dictates wether to automatically save a document that has been changed, and if so, how long to wait before saving (files.autoSaveDelay)
  2. ObjectScript extension's compileOnSave (objectscript.compileOnSave), which determines wether after saving the document, this also imports into and compiles on the connected IRIS namespace.

Since I had autosave turned on, and on a short wait delay together with compileOnSave meant that partially edited code kept compiling, generating the above erros, and as mentioned, sometimes re-formatting good, pre-existing blocks of code.

In my case, I have settled on the following:

  1. AutoSave (files.autosave) off (autosaveDelay is ignored),  and
  2. CompileOnSave (objectscript.compileOnSave) on.

Now, when I'm happy with my edits (in my own time !), I press Ctrl-S, to save, import and compile my class, and look out for that pop-up message which has real meaning and purpose now.

You may choose a different combination, (for example, go ahead and Autosave after 5 minutes or so, accepting the code may not fully compile), however, I've found the above combination works for me, and hope that - if you are experiencing the same annoyance, then, this article may help you find your optimum configuration.

Thankyou to @patrick.Sulin7198, and @raj.Singh5479 for pointing me in the direction of these settings !

Steve Pisani

 

Warp.dev image

Warp is the #1 coding agent.

Warp outperforms every other coding agent on the market, and gives you full control over which model you use. Get started now for free, or upgrade and unlock 2.5x AI credits on Warp's paid plans.

Download Warp

Top comments (0)