Skip to content

VS Code

Visual Studio Code with the Remote - SSH extension lets you edit files on the cluster as if they were on your computer, with a file browser, syntax highlighting and an integrated terminal.

Setup

  1. Install VS Code and the Remote - SSH extension on your computer.
  2. Add the cluster to the ~/.ssh/config file on your computer:

    Host imtm-hpc
        HostName login.hpc.imtm.cz
        User your_user_name
        IdentityFile ~/.ssh/id_ed25519
        ServerAliveInterval 60
    
  3. In VS Code, press F1, select Remote-SSH: Connect to Host... and choose imtm-hpc.

  4. Open a folder in your home or project directory with File → Open Folder.

On the first connection, VS Code installs its server into ~/.vscode-server in your home directory.

Rules For Using VS Code

VS Code runs its server on the login node, which is shared by all users. Keep the load low:

Warning

  • Do not run computations in the integrated terminal or with the Run button. Submit them as jobs, or start an interactive job in the terminal with qsub -I.
  • Do not open huge directories, such as a whole project directory with millions of files. VS Code then indexes all the files and loads the login node. Open only the folder you work in.
  • Install only the extensions you need on the remote side. Language servers, e.g. for Python or R, use a lot of CPU and memory on large projects.

To exclude large data directories from indexing and file watching, add them to the settings of your workspace .vscode/settings.json:

{
    "files.watcherExclude": { "**/data/**": true, "**/results/**": true, "**/.snakemake/**": true },
    "search.exclude": { "**/data/**": true, "**/results/**": true }
}

Cleaning Up

The VS Code server is updated with every new version of VS Code and old versions stay in your home directory. If your home directory gets full, close VS Code and remove the server, it is installed again on the next connection:

du -sh ~/.vscode-server             # Check its size
rm -rf ~/.vscode-server             # Remove it

Tip

For Jupyter notebooks, run JupyterLab in a job as described in Jupyter, instead of running notebooks in VS Code on the login node.