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.
- Install rmate on the remote computer. rmate has been ported from its original Ruby implementation to Python, Bash and other languages. I like to use rmate-python. Installing it is easy:
$ sudo pip3 install rmate
- On your local VSCode, install the Remote VSCode extension from here.
Open Preferences → Settings and in the User Settings window, add the following settings:
//-------- 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
Restart VSCode and run the command Remote: Start server by pressing F1.
SSH to your remote machine with port tunneling:
$ ssh -R 52698:127.0.0.1:52698 yourlogin@remotecomputer
- Once you are SSHed into the remote computer, run this command there:
$ 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