Skip to content

Using VS Code on Meluxina to ease your developments

Visual Studio Code (also called VS Code) is a well-known IDE. It also offers a powerful and convenient way to streamline remote development, including on high-performance computing systems like Meluxina. By using VS Code's Remote - SSH extension, developers can efficiently write, edit, run and debug code directly on Meluxina while leveraging the familiar VS Code interface on their local machine.

Local installation and setup

1. Install Visual Studio Code

If you haven't already, download and install Visual Studio Code on your local machine.

2. Install the Remote - SSH Extension

To enable remote development via SSH, you need to install the Remote - SSH extension.

  • Open VS Code.
  • Go to the Extensions View by clicking on the Extensions icon on the left sidebar or pressing Ctrl + Shift + X.
  • In the search bar, type "Remote - SSH" and install the extension developed by Microsoft.

3. Set Up SSH on Your Local Machine

Before connecting to a remote host, ensure that you can SSH into the remote server from your local machine. See our documentation on this matter here.

We present here two possible options to set up the SSH connection from VS code: from scratch if you do not have an .ssh/config file, and on the contrary, how to use a config file if it's already present.

Setting up the connection to Meluxina from scratch

In the case where you do not have an .ssh/config file, VS Code helps you to generate one. We will see here the necessary steps to do that.

Press the bottom left corner to open a remote window:

create a remote connection

Then press "Add New SSH Host"

Add new connection

You are then prompted to enter the SSH connection you use to connect to the target SSH server (Meluxina in the present case).

ssh YOURUSER@login.lxp.lu -p 8822 -i ~/.ssh/id_ed25519_mlux

SSH Connection command

After hitting enter, VS Code prompts you yo know if you want to check the configuration file it generated. If you have a look you should see something like shown below.

Config on VS Code

Once connected, you’ll see a new VS Code window open with a [SSH: meluxina] indicator in the bottom-left corner, indicating that you're now working on the remote host. For the future connection, the above steps won't be necessary anymore and you will be able to use the generated config file.

Use an already existing configuration file

If you already have a config file, usually located on your local machine at ~/.ssh/config if you are on a UNIX system, openning a remote VS code session is even simpler.

Press the bottom left corner to open a remote window:

create a remote connection

You should then see the different known hosts for which you have ssh connections configured:

known connections

Once connected, you’ll see a new VS Code window open with a [SSH: meluxina] indicator in the bottom-left corner, indicating that you're now working on the remote host.

Usage

Interact with the Meluxina filesystem

To open a folder or project on the remote machine:

  • In the newly opened VS Code window (connected to Meluxina), go to File > Open Folder....
  • Browse and select the folder on the remote host that you want to work on. VS Code will then load the folder from the remote machine and display it on your local interface.

From the filetree, you can also manipulate files from the GUI of VS Code and performs actions like copying files, deleting them, rename or move them and so on.

Install Extensions for Remote Development (Optional)

You can install any necessary extensions for the programming languages or tools you're using on Meluxina. Some of these extensions can really help you boost your productivity. We particularly recommend the following ones:

  • C/C++ from Microsoft,
  • PyLance from Microsoft,
  • Vim the vim emulator from vscodevim which will allow you to have vim keybindings directly from VSCode
  • GitLens by gitkraken.com

When you try to install an extension, VS Code will prompt you to install it on the remote machine rather than your local system.

Use Terminal and Debugger on the Remote Host

VS Code will also provide you with access to a remote terminal and the ability to run/debug code on Meluxina directly.

Go to Terminal > New Terminal to open a terminal directly on Meluxina. As you can see below, you will attain a login node, from which you can run an interactive session for instance, or launch jobs/commands.

Terminal

Transfer Files Between Local and Remote

VS Code allows you to easily transfer files between your local and remote machines using drag and drop. Simply drag files between VS Code windows to upload/download between the local and remote systems.