Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to edit remote files using Remote VSCode

📅 2018-May-03 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ remote vscode, rmate, rmate-python, ssh, visual studio code ⬩ 📚 Archive

Visual Studio Code is a great editor for local files. Remote VSCode is an extension that enables editing files on remote systems in your local VSCode. Note that you will need to specify individual files on the remote computer and they will appear in your local VSCode. You cannot open a remote folder and expect all of the code there to be indexed for code browsing with this method.

$ sudo pip3 install rmate
//-------- Remote VSCode configuration --------

// Port number to use for connection.
"remote.port": 52698,

// Launch the server on start up.
"remote.onstartup": true

// Address to listen on.
"remote.host": "127.0.0.1"

// If set to true, error for remote.port already in use won't be shown anymore.
"remote.dontShowPortAlreadyInUseError": false
$ ssh -R 52698:127.0.0.1:52698 yourlogin@remotecomputer
$ rmate -p 52698 file/you/want/to/edit

The file will appear in your local VSCode for editing. The remote file will be updated with any changes you make locally after you save the file.

Tried with: Visual Studio Code 1.22.2 and Remote VSCode 1.1.0