How to install vscode on arch linux (and arch based distros)

How to install the official vscode package on arch linux and arch based linux distros like manjaro, arco and any other arch based distro

.

To install the official vscode package, we will have to install the visual-studio-code-bin package from the aur.

You can even choose any one of the open source builds
for more info, go to Arch Linux wiki page for vscode

there are two ways to install vscode from the aur
  1. using aur without helper
  2. using aur with helper (yay)

installing without helper

to install from the aur you need to install git and base-devel to install them execute the following command

$ sudo pacman -S git base-devel

Then you have to clone the git repo from the aur. use the following command in any directory

$ git clone https://aur.archlinux.org/visual-studio-code-bin.git

then install the package

$ cd visual-studio-code-bin/
$ makepkg -si

now that you have installed vscode, you can run it by running the command

$ code

or you can open a directory in vscode with

$ code path/to/directory

installing with aur helper (yay)

if you only want to install one package from the aur, it is better to install it without a helper. However, if you want to install more packages from the aur in the future, I strongly recommend using a helper.
I will be installing yay

install helper

to install from the aur you need to install git and base-devel to install them execute the following command

$ sudo pacman -S git base-devel

Then you have to clone the git repo from the aur. use the following command in any directory

$ git clone https://aur.archlinux.org/yay.git

then install yay

$ cd yay/
$ makepkg -si

install vscode with yay

you can install any package from the arch repos or the aur just like you use pacman to install them.
don't run yay as root
to install vscode with yay, run the following command

$ yay -Sy visual-studio-code-bin

now that you have installed vscode, you can run it by running the command

$ code

or you can open a directory in vscode with

$ code path/to/directory

font

this package does not include the default vscode font Droid Sans Mono
to install this font, you can run

$ sudo pacman -S ttf-droid