Visual Studio Code (“VS Code” in brief) is an open-source and cross-platform text editor developed by Microsoft, which supports Windows, macOS, and Linux operating sytems, as well as x86, x64 and even ARM architectures! You can install a lot of extensions to customize the code editing tool and make it function like a mini Integrated Development Environment (IDE). You can click here to download Visual Studio Code.

When installing the software on Windows, it is recommended to select the options “Add ‘Open with Code’ to the context menu” and “Add ‘code’ to the PATH”. It is also recommended to download Git for Windows.

Extension Recommendation

I often use VS Code for C/C++ and Python development, and there are some great extensions to make coding life easier. Thanks to the developers of these awesome extensions!

Tiny Light

No matter which programming language you are using, this color theme is one of the best color themes in VS Code for your eyes!

Install the extension

vscode-icons

The extension sets the file icons for VS Code, and it might support thousands of file types!

Install the extension

C/C++

The extension is the official C/C++ support for VS Code by Microsoft and provides C/C++ intelliSense, debugging and code browsering. It will automatically include the header files in the current workspace (i.e., current working folder) and the include path of the C/C++ compiler.

There is also another extension called C/C++ Extension Pack made by Microsoft, but I personally do not recommend this extension as there are too many unnecessary extensions in the pack.

Install the extension

Python

The extension is the official Python support for VS Code by Microsoft, including features such as IntelliSense, linting, debugging, code navigation, code formatting, Jupyter notebook support, refactoring, variable explorer, test explorer, snippets, and more! You can select the Python interpreter by clicking on the status bar, and debug your Python code through the Debug Activity Bar.

Install the extension

Git Lens

Though VS Code already has the built-in Git support, the extension just makes the Git capabilities in VS Code more powerful! If you are not familiar with the Git commands and prefer the graphic user interface, this extension will be a good choice for you!

Install the extension

Settings Sync

Even though recent VS Code updates include the experimental feature that lets you sync the settings with your Microsoft or GitHub account, this extension already fulfills the functionality. It creates a Gist on the GitHub which stores the settings.json and extension list.

Install the extension

Run VS Code on Remote Server

If you have all the development environment set up on the remote server, you probably wonder whether there is a way to develop your program on the remote side. The answer is YES! You can use VS Code as if you are using it on your local machine.

W/ GUI

If the GUI is already installed on the Linux server, one straightforward way to use Visual Studio Code is to install the software directly on the machine. To use the GUI on the remote server, you need to make sure your SSH client supports X server, and then connect the remote machine with ssh -x option.

After downloading the .deb file from the website, you can install the file in two ways (replace code.deb with the actual file name):

  • If you have the access to the root user, you can use the command sudo apt-get install code.deb to install Visual Studio Code for all users.
  • Otherwise, you can use command dpkg -x code.deb ~ to unpack the code.deb to your home directory. You can find the executable file in ~/usr/share/code/bin.

W/O GUI

Previously it was a little bit tricky to use VS Code on the Linux server that is not equipped with GUI. My personal workaround is to install a third-party extension named “Remote VSCode”, but it only supports basic file editing features of VS Code, which means you cannot use cool features provided by the extensions. Since Microsoft develops the extension of “Remote Developement”, it turns out to be a different story. The extension lets you open any folder on a remote machine, and use extensions on the remote side.

The only issue you might encounter for the extension is when you try to connect to your target server through a middle node on Windows. For normal SSH connection, we can use ssh -J option or ProxyJump in config file. But the OpenSSH client used in Windows 10 does not support the proxy jump yet. There are two solutions for the issue:

  1. Change the default SSH client (e.g., ssh.exe used in Git Bash) for Visual Studio Code. You can specify its location in settings.json file with the remote.SSH.path field.
  2. Instead, we have to use ProxyCommand syntax in the config file. Here is an example of how to connect to the target server through a middle host.
Host target
HostName target.someplace.com
Port 22
ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p middle.someplace.com

Have fun Coding with Visual Studio Code!