This is an old revision of the document!
The Visual Studio Code integrated development environment (IDE) makes it possible to edit program code locally, and compile and execute it remotely, through a SSH connection.
This is a very useful and powerful feature, but not everything is possible, or easy.
Perhaps strange to suggest on a page about the use of ssh in vscode, to first suggest not to use ssh. But if possible, a local setup is much easier, as you may realize after reading (and trying) the other setups.
All our desktops, including the vdesk cluster, have a recent version of vscode installed. You can find it in the menu, or execute the command code
from the terminal. Starting from the terminal has the big advantage that you can setup an environment first, and then everyting you compile or run inside vscode will be using that environment. Example:
module load AMUSE/2023.5.1 code
this will run the vscode program with the AMUSE environment loaded, so you can directly execute your AMUSE scripts from vscode.
If you are on a laptop or a remote machine, try one of the methods for remote access eg the vdesk web interface, or a VNC or X2GO session. In that way you can display everything locally, and yet have full access to the remote execution environment.
Instructions for installing the vscode ssh plugin can be found here.
The page also has information about setting up a local ssh client, if you don't have one yet (Windows; putty is not supported, you need the commandline ssh client here, which is already present on Linux and Mac OS)
Next, set up key-based ssh, so you don't have to type a password a couple of times when you open your remote vscode. Some functionality will not even work with password-based logins anyway. Take care of the secrecy of your private key. It's called private for a very obvious and very impoirtant reason. If you loose that key or if others get their hand on it, your account is compromised and you should immediately contact the helpdesk for removing the key and resetting all login related settings.
$HOME/.vscode-server
and space in teh home disk is limited. If this fails, check your quota, move things around, get rid of the incomplete vscode directory and try again.mkdir /data1/username/.vscode-server ln -s /data1/username/.vscode-server $HOME
Once you have configured the plugin to log in directly to your target system, vscode can compile, run and debug code there. But it will do so in the default login environment. It is not easy to configure loading environment modules, conda environments or python venv. If you need such an environment loaded to run your code, follow these steps:
Terminal
menu)module load AMUSE
, or source myenv/bin/activate
for venv, etc)See also https://code.visualstudio.com/docs/python/environments
TO BE DOCUMENTED
TO BE DOCUMENTED