Ever since I upgrade from Ubuntu 16 to 18, VSCode has been crashing my PC. My desktop would freeze (no way to escape or switch to terminal console) after a random amount of time after I open VSCode.
I have a GeForce GTX 660 video card. Ubuntu 18 used the Nouveau display drive (xserver-xorg-video-nouveau) open source drivers by default.
Switching to the NVIDIA proprietary drivers fixed my issue. I suppose there’s some kind of bug with the Nouveau drivers that the VSCode hardware acceleration triggers.
You can change drivers in Software & Updates under Additional Drivers.