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

Answers

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

If you disable ObjectScript VSCode and enable Serenji I hope you'll be able to work the Serenji way. Please try it.

Ok, I'll try.

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

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

Thanks for all

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.

Yes, using Serenji extension.

You say that is only server-side code? it's strange, because the client-side is changed too

Please clarify what you are referring to when you say "client-side code".

Folder within VSCode? Or folder on your local disk, that you could browse using Windows Explorer or macOS Finder in order to see a set of textfiles containing classes, routines etc?

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.