Question
· May 20, 2019

How to sync Server and local cache code using Visual Studio Code

Hi all,

I wonder how to sync my server code to my local code using Visual Studio Code.

Previously, using Atelier, you could open a view of server and can copy the code to the current project, also if I change a BP, I could sync the code because I had a signal that It's warning me that there was a change and it needs to be updated.

I thing i shouls opening the ObjectScript: Explorer and select the code directaly, and right click -> Import and compile current file (Ctrl + F7)

If I use this command, the ouptut window shows:

Compilación iniciada en 05/20/2019 11:32:16 con calificadores 'cuk'
Class MyClass.Rest está actualizado.
Compilación correcta terminada.
EPERM: operation not permitted, open '\MyClass.Rest.cls'

 

So the local code still as it was.

What is wrong? is there another way to sync the code from server to local?

 

@Dmitry Maslennikov  help me crying (or anyone laugh)

Best regards

Francisco Lopez

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

Francisco

You could try using the Serenji extension for VSCode.  This avoids the problem of syncing altogether.

Serenji allows you to browse, edit and debug your code directly in the database where it is stored and executed.  So you don't have any problems with the sources being out of sync because it just can't happen.

George
www.georgejames.com

Hi George,

I'm trying to configure Serenji in server and client. In workspace configuration I've got the following code:

"settings": {
        "objectscript.conn.host": "1.1.1.1",
        "objectscript.conn.label": "DEV",
        "objectscript.conn.password": "<myPassword>",
        "objectscript.conn.version": 2,
        "objectscript.conn.active": true,
        "objectscript.autoCompile": true,
        "objectscript.autoPreviewXML": true,
        "serenji.servers": {
            "1.1.1.1":{
                "host": "1.1.1.1",
                "port":43221,
                "username":"_SYSTEM",
                "password": "<myPassword>"
            }
        }
    }

I've replaced IpServer and myPassword for security.

In server I've installed as is explained in https://georgejames.com/files-cgi/doc/serenji/3.0.2/GettingStarted.html

Now, my question is... How to sync the code? I'm not see any menu item or something to do it, maybe I'm not using correctly.

Best regards.

Edited: I've created the worspace and it is trying to connect, but I have the following error:

 
[trace] stat /
[error] Timed out connecting to Serenji Service at 1.1.1.1:43221 (1.1.1.1)
 

 (Real IP is changed)

The server hasn't any firewall that is blocking it. Any idea?

Did you intentionally start your Serenji service process on port 43221 rather than the default port, which is 43211?

You can check the status of that service process by running this command in a Cache Terminal:

D ^%Serenji

The output includes  a section like this:

Serenji explore/edit/debug service
----------------------------------
 Service status: Running
   Primary port: xxx
   Aux port min: xxx
   Aux port max: xxx
 Server address: xxx

Ok, it was due server port. Now it is connected with the server, but ObjectScript VSCode extension is disabled. Now, I'm not able to compile :(

All previous configuration for ObjectScript VSCode extension was working, and the configuration still in folder configuration and workspace configuration.

Edited: If I disable Serenji, ObjectScript VSCode begin to work

I've checked that it compile, is synchronized server-client and vice versa.

Is this referring to when you're using the Serenji extension? If so, understand that there is no client-side copy of your code (so no synchronization involved). Serenji works directly on your server-side code.

It's good. Only I'm missing the intellisense

Yes, Serenji doesn't yet do a good enough job of providing Intellisense. It's on our roadmap.

Actually, with my VSCode extension is not supposed that you need to sync your code. It expects, that you have only one source of truth, your local sources. But if you can export any code from the server, it can be the same folder where your sources already placed or any others. Just use Export action in Context menu in Explorer, and it will export all your classes or routines.

When you try to open any file in explorer, and this class or routine you already have locally, it will show your local file instead of server's file. Just because it does not expects any difference, as I said your local sources have the privilege to be used first.

Any file opened from server will be shown in read-only mode.

Hi,

My 2c on this, and maybe I am missing something or do not know how to use these VSCode extensions correctly.
The single source of truth principle can't really be applied when using these extensions, as BPLs, transformations, and rulesets should still be edited in the Management Portal or in Studio.

Because there is not a sync functionality, I have seen devs overwriting changes on BPLs, etc., when they import and compile from VSCode. You have to explicitly export it on the server explorer.

Please correct me if I'm mistaking.

Yes, it’s not possible to edit BPL and some other resources which has their own UI editor with VSCode, yet. But, most of those kinds are classes in the end, and can be stored in source control system as classes, and you can edit them as classes, with no helpful UI, yes. There are a few limitations on implementing the current web editor to VSCode, mostly by security reasons, and I hope we’ll find a way how to solve it.

Stefan, it sounds like you could benefit from using the server-side editing capabilities of this extension, in combination with server-side source control such as Deltanji from George James Software (for whom I work). Properly implemented, server-side source control will also control people who edit using Portal and Studio, or who use our Serenji extension for VS Code instead of the InterSystems one.