25

VSCode: Development over SSH Review

 4 years ago
source link: https://www.tuicool.com/articles/hit/ziMVr2a
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

While browsing Friday night, I came across Visual Studio Code's Insider edition with the SSH Development feature, billed as a simple solution to develop on remote machines (eg. LXC containers, VMs, VPSes, etc) from any supported device running VSCode. I decided to give it a try first-hand, while developing my customer management platform.

First Glance

It was super simple to install, it took a bit of reading to figure out which extensions I needed (Development Pack), and was smooth sailing from there.

image.png

I'm running it on both my Ubuntu + Mac development environments. In order to connect, I click on the little computer icon (left sidebar), and the REMOTE-SSH tab comes up. I see help & feedback, and a list of my known connections.

image-1.png

Click the cogs icon next to "CONNECTIONS", and select your .ssh/config file on Mac + Linux.

image-2.png

It should populate with locations (eg, /Users/username/.ssh/config/, /etc/ssh/ssh_config, etc).

You should be able to add configuration that looks similar to this, substituting as necessary:

image-3.png

Next, hit the little connect button for new-tab connect, or, double click your host on the left sidebar. It will begin to connect to your desired host. Once you have your UI open, open your desired folder (in my case, /opt/ispmngr/connect), here's how your editor should look:

image-4.png

Next, you can select files / install extensions, and even use the built-in VSCode terminal to run commands over SSH. One thing I've found, is that some extensions can be installed on the remote host (not local machine), so you can just install once, and pickup anywhere, on any device you want and not need to re-install the extensions. It's really made development a lot easier for remote machines, even debugging applications.

Review

Overall, the experience is great. I love the ability to manage git, ssh terminal, do files in real time, debug, and all the conveniences I have locally. However, I found some actions I had to take redundant:

  1. I had to install an extension for SSH to work, I'd much prefer this be already baked in, and possibly a setting to enable it?
  2. Doing anything with sudo is challenging , you need to ensure you have the right file permissions, or VSCode will not like it. I've found if you make a new usergroup, own the files by said usergroup, and give your development users access to the group it's fine. I'd like the ability in VSCode to enter a sudoer credential, so I don't have to give everyone sudo. Some things I'd prefer no one but X touch
  3. I found that if your program has iterative loops (eg, python for loop with > 100,000 records it has to iterate over), and you print data to the terminal, VSCode will start hogging lots of resources - it may be worth batching these up. In any case, this fix is simple as you can pipe to a log file + view inside VSCode (or, wherever you view your logs already)

Overall, this is great news - for anything like Python, JS/TS I have a perfect IDE. However, right now due to PHP support, I'll have to stick with my messy Jetbrains PHPStorm setup. One step at a time, I suppose!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK