You don’t have swap,when you reach the maximum memory your system freezes,try creating swap,I recommend swap on zRAM,there is a script on the AUR to enable it with one click called zramd,you can install it with
pamac build zramd
then enable it
sudo systemctl enable --now zramd
Try run vscode again,your system should not freeze anymore.