Use Visual Studio Code SSH without crashing your server

Ben Olayinka
good robot
Published in
4 min readFeb 2, 2020
hello, world?

tl;dr:

Have you used the Remote SSH extension in Visual Studio Code? You may not have realized, but with default settings it eats up a RIDICULOUS amount of cpu on the host.

On small or shared core servers, this can easily exceed 100% cpu capacity, shut down critical processes, and make the server useless real quick.

The solution is to disable the automatically enabled, totally hidden, idiotic TS/JS Language Service extension which installs and runs massive node processes on your server. Instructions at the bottom.

SO…

I’m a sublime text person. If not for one small shortcoming, I would still be using it 100% of the time — I’m in love with the speed, low resource usage, and pretty colors 😍

preeeetttttyyyyyy

The one thing sublime text definitely lacks, though, is a good sftp client. Because of API limitations (and because sublime is a closed-source project maintained by ONE GUY!?) extensions like SFTP for Sublime can’t give a local-like dev experience, so you have to use weird workarounds like navigating entirely using the search bar.

ew! the sublime sidebar is replaced by this!

This was annoying enough to make me willing to try something I said I’d never ever ever try again, since I bought my first Macbook in 2011……

I decided to try a Microsoft product 😭

Enter Visual Studio Code. Lately, I’ve noticed more and more of my friends gradually shifting over, and laughing at all the modifications they make to trick VS Code into looking like sublime text does out of the box.

I won’t rant too much more here, but in my opinion, the worst thing about Microsoft stuff is that their products which are supposed to ‘just work,’ never just fucking work, and you’ve always gotta do lots of tinkering to get something usable.

VS Code is apparently no different. The first time I booted it up and connected to my Google Cloud Compute micro instance, I got about half a second to appreciate the ‘tight remote experience,’ before VS Code disconnected. I thought ah, a reincarnation of the infamous Microsoft blue screen of death!

hello, world?

But then I tried to ssh in to my server via the terminal, and then I tried to browse to my site, and then I realized the ugly truth — VS Code crashed my server completely!!

Google’s Cloud monitoring showed a 100%+ cpu spike at the same time VS Code connected.

I did a little research about how SFTP works, but unfortunately there’s little to no documentation about what VS Code is doing behind the scenes.

I eventually figured out that the Remote extension in VS Code works by installing a bunch of stuff on your server. I restarted the server and ran top, to see exactly what. I found these crazy node processes:

Killing the node processes immediately crashed VS Code. More googling taught me that Code silently installs node on your server (already ridiculous), and then runs a bunch of javascript tools for ‘intellisense,’ which is basically autocomplete.

100% cpu for AUTOCOMPLETE! And they never tell you it’s there, and there’s no instructions for disabling it.

So long story short, if you’re tired of VS Code eating up all your cpu, here’s what you need to do.

How to disable TypeScript and Javascript Language Services in Visual Studio Code and get your server back:

  1. Hit the extensions button in VS Code (which looks like building blocks on the left toolbar)
  2. Search for ‘@builtin TypeScript’.
  3. Disable the TypeScript and Javascript Language Features extension
  4. Reload

Voila! You’ve officially tinkered your Microsoftware in to being actually usable!

And honestly, though I’ve been pretty hard on it, once you get the kinks worked out, VS Code can be pretty nice :) Best of all, it’s mostly open source, so when you encounter more questionable design decisions, you can probably go in and fix them yourself.

--

--

Ben Olayinka
good robot

Ben is an engineer, an optimist about love, a record collector, a poser writer, and a goofy DJ who plays disco everywhere.