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:
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 (or anyone
)
Best regards
Francisco Lopez
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:
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:
(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:
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
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.
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".
The source of the project in my folder
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?
Local disk, the same code that you can see in Atelier
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.