If you have access to a CentOS 7 machine (through ssh) that you can use for code development, but you don’t have convenient interactive access to it, or don’t have administrator rights to it, this method is probably the most convenient way of using VS Code for ATLAS code development for you.
In this setup you can run VS Code on any one of its supported platforms (many flavours of Linux, macOS and Windows).
The requirements on the client side are very lightweight with this approach.
If you are connecting remotely (i.e. from outside CERN), please first have a look at ssh tunnelling below.
If you are running on Windows, you should also follow the Windows instructions on installing OpenSSH.
F1, and choose “Remote-SSH: Connect to Host…” (or possibly
“Remote-SSH: Connect Current Window to Host…”), and enter the host that you
want to connect to.
Once the connection is established (probably after you had to enter your password), make sure that all the extensions that you’ll want to use, are “enabled” on the remote host. Note that you do not need to do this on every connection, only during the first time that you are making use of the host.
Next you need to set up your work area. One convenient way is to open a new terminal from the VS Code top menu, and in that terminal set up a partial build of athena as you normally would. With something like:
cd <some appropriate place> git clone ssh://email@example.com:7999/<username>/athena.git <set up the appropriate branch> <create a package_filters.txt file> mkdir build cd build/ asetup <the appropriate release> cmake -DATLAS_PACKAGE_FILTER_FILE=../package_filters.txt ../athena/Projects/WorkDir/
With that done, you can finally tell the application to open the freshly cloned athena repository for editing.
Note that when you do this, VS Code will “re-initialise” the connection. Meaning that you will (probably) have to re-enter your password, and the terminal that you used previously, will go away. Because of this, it can be a very viable option to do the initial setup of the work area on the remote host in a terminal independent of VS Code, and only once the repository and the build directory have been set up, connect to the host with the editor.
If you did everything correctly, now you can start editing the source files in the package(s) that you set up for the partial build.
If you want to connect to a machine behind a firewall (for example, you want to connect to your CERN desktop from home) then you can do the following:
ssh -N -L 2222:REMOTE_MACHINE_NAME:22 USERNAME@lxplus.cern.ch
If you are on a Windows machine, you should first follow the Windows instructions to install an OpenSSH client and server.
You can now follow the standard setup instructions above, except using
localhost) as the remote host to connect to. Specifically, you will need to click “Remote-SSH: Connect to Host…”, then choose ‘Add New SSH Host’ and then use the following ssh command :
ssh -p 2222 USERNAME@127.0.01. You only need to do this once, as long as you save it in a
.ssh/config file as prompted: next time, you can just select
127.0.0.1 from the list.