FOR AMD64 architecture PC
sudo apt update
sudo apt install -y curl apt-transport-https
curl -sSL https://packages.microsoft.com/keys/microsoft.asc -o microsoft.asc
echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
sudo apt update
sudo apt install -y code
If you want to use default editor as 'code' below command will help you
sudo update-alternatives --set editor /usr/bin/code