Question
· Nov 2, 2020

Where to save the local cache code after connecting the IRIS server using Visual Studio Code

Hi all,
By using VS code, I want to copy multiple files to local directory, then sync them to server, but I can't find where local directory is stored?
In Atelier IDE, I could open a view of server and can copy the code to the project, then code is saved in the local directory. When I copy multiple files to the local directory -> choose sync in Atelier -> the code will be synchronized to the server
How to do this from VS Code?
Thanks!

Discussion (14)0
Log in or sign up to continue

In VSCode you just had to open any local folder. And it's a manual choice. 

When you opened any folder, which is supposed to be as a project root. Configured the server connection, you then should be able to open ObjectScript Server Explorer (by InterSystems logo icon). There you can observe your code on the server, and do export from context menu. Export will be logged to ObjectScript output, with full path's of exported items. Go to File explorer in VSCode (default view), and from context menu on any folder or class, you will have action Import and compile.

Well, maybe I don't quite understand MAC files.  I tried again this morning and helloWorld.mac kept erroring with an illegal header.  I added 'ROUTINE helloWorld' the top.  Still didn't work.  Added helloWorld.inc and now the MAC file has compiled.  I thought the MAC file compiles down to the INT file.  I'm not even sure what the INC file is. 

I am also having a odd time with connections.  My Docker stats show this:

Ports
1972/tcp localhost:9091
52773/tcp localhost:9092
 
and my setting are as such:
 
"objectscript.conn": {
            "ns""TEST",
            "server""docker-my-iris",
        "active"true
    }
 
"intersystems.servers": {
 
        "docker-my-iris": {
            "webServer": {
                "scheme""http",
                "host""localhost",
                "port"9092
            },
        }
    },
 
For some reason it connects me to the USER namespace even though I've indicated TEST.
 
Happy to email or use the DM feature to take this off the boards if it's too messy to help with here :)

I think we need a webinar on this)

In VSCode you are SUPPOSED from step one to open a folder with code that you can import to a server for compilation/testing.

If you have the server but not files you can open an EMPTY folder, connect to the server, and export code - but this is sort of the first exception because you are supposed to have a repository for the code in advance.

Yes, a webinar!

I'm not following the concept of starting with the project and using VS Code to compile/test.  Where would you do your local development then?  Isn't that why we use VS Code?

Reading the documentation, I'm also confused if local development is even desirable?  In my case I have IRIS community running docker and I have Cache 2018 running on my local machine (can't get IRIS locally as it's a work computer and locked down).  In this case I probably just want to develop all my code on the server?

Reading the documentation, I'm also confused if local development is even desirable?  In my case I have IRIS community running docker and I have Cache 2018 running on my local machine (can't get IRIS locally as it's a work computer and locked down).  In this case I probably just want to develop all my code on the server?

It's up to you, of course. Developing the code "sitting inside" the server it's sort of the option only IRIS provides.

If you think what's going on when you develop "on the server" is when you change the class you change it in some global on the server and when you compile it you send the global to the compiler. And when you good you try "not-to-forget" to export code into a file and commit/push to the repository.

I prefer to edit files from the first step and send it to the server for compilation/testing and then commit/push the file - I'll never forget it cause VSCode helps me to manage it nicely with changes and things like that.

And it's not a big deal where do I send it to compile/test - whether it is local IRIS in docker or host or any remote development server.

I see below that you've asked Raj to get a webinar going, so I will look forward to that!

I think I'm just getting bogged down in terms.  You said that server-side dev is the only option IRIS provides, but so far what I've experienced is that I can edit a .CLS or .MAC file in my local workspace and then on save it's sent to the server (the container running IRIS) and compiled. 

Now that I've saved that file and it's on the server, to continue making changes I should open up the server-side file and continue editing from there?  Or I can continue working on the local and it will overwrite the sever side?

I think I'm seeing your point about commits then.  I edit it locally, it's sent to the server, the server sends it to the repo, and locally I should pull down the repo before continuing any changes. Is that the idea?

The development lifecycle and source control at my work doesn't utilize modern source control (git) and it's my first programming job (no context elsewhere), so it takes me a while to grasp some of these things :)

you said that server-side dev is the only option IRIS provides,

I meant IRIS, or Caché, or Ensemble - when developers really store and even edit code on the server. 

Now that I've saved that file and it's on the server, to continue making changes I should open up the server-side file and continue editing from there?  Or I can continue working on the local and it will overwrite the server side?

you can continue editing it locally sending it to the server for compilation/testing every time.

I think I'm seeing your point about commits then.  I edit it locally, it's sent to the server, the server sends it to the repo, and locally I should pull down the repo before continuing any changes. Is that the idea?

The idea with starting from a local folder with files, which is connected with source control. So any changes to the files are automatically being tracked by the source control you use (git, svn, mercurial, whatever). You use the server only to compile/test things - no connection to source control needed on a server-side.

This is how things happen in almost any programming stack.