-
Ensure VS Code version is >= 1.35 (May 2019)
-
Install Remote Development through the VS Code marketplace
-
Install OpenSSH client and server through Settings>Apps & Features>Manage Optional Features
-
If you are using Pageant and Putty follow these instructions. Ensure your public key is in
~/.ssh/authorised_keys
.-
Else add this line to settings.json in vscode
"remote.SSH.showLoginTerminal"*: true,
Unfortunately you will have to enter your password multiple times. Research can be done from here to find out how to avoid this. It will probably involve running ssh-keygen in the command line.
-
-
Either from the command palette (F1) or from the >< Icon in the bottom left run
-
Remote-SSH: Open Configuration File... > Configure SSH Hosts
-
Select the first option and add the following template to the config file
Read more about SSH config files: https://linux.die.net/man/5/ssh_config Host name-of-ssh-host-here User your-user-name-on-host HostName host-fqdn-or-ip-goes-here IdentityFile C:\path\to\your\exported\private\keyfile\from\step\3 ForwardAgent yes
For example
Host virtualMachine HostName dyn822 User carlin ForwardAgent yes IdentityFile C:\Users\carlin\.ssh\private
-
-
Now run Remote-SSH: Connect to Host... > name-of-ssh-host-here. A new VS Code window should open and it should connect to the virtual machine.
Perform steps 1, 2 and 5
As of now the only way I have found of disconnecting is to close the VS Code window. Typing exit
into the terminal doesn't work and there doesn't seem to be any options in the Remote-SSH left panel.
After opening the new SSH VS code window there should be a panel open with a terminal which says:
Connected to SSH Host - Please do not close this terminal
If you click the plus in the bar above this message, a bash terminal should open at the directory you are currently in. cd
ing won't move your position in the explorer but git etc will work as expected. To open files you can use code path/to/file
-
To perform a hound-like text search in the open directory press Ctrl-Shift-F
-
To find a file by name use Ctrl-P
-
To search for an action to perform (such as Toggle Word Wrap, Format Document, Reload Window etc) use Ctrl+Shift+P or F1
-
To go to a line number use Ctrl-G
-
Git Lens (eamodio.gitlens) - Highly capable git capabilities that allow lots of interesting features like inline blame annotations, multiple repositories, file history, dynamic comparison of branches and much more. Better to stick to command line for actual git commands, but for viewing diffs, blame etc it's priceless
-
Prettier (esbenp.prettier-vscode) - Code formatter for many languages, can be manipulated with JSON. Works best with the editor.formatOnSave setting set to true.
-
Perltidy - Same as above but uses the perl library. These command line arguments work better with Netcraft syntax "perltidy.additionalArguments": ["--cuddled-else", "--all-containers-tightness=2"]
-
Bookmarks (alefragnani.bookmarks) - Useful for large files where changes need to be made across multiple functions, bookmarks can be toggled with a keyboard shortcut and appear in the scroll bar.