Remote development is a really cool and useful feature of VSCode. Especially handy if you want to develop on a raspberry pi on your local network. Although there are many ways to share code between two hosts, if you want a really direct way to interact this method is great. VScode has a remote development extension for this.
The extension connects with ssh to the remote host and establishes a tunneled connection. Since it uses ssh-keys to authenticate you don't need to enter passwords at all while still connected in a secure way.
The look and feel is the same as if you would develop locally. You can see in the image below that VScode is showing a remote folder in the titlebar of the window (saying [SSH: raspi4]) and in the bottom left of the statusbar stating: SSH: raspi4.
1) create a new development user on the remote raspi
Login as pi (or your admin user on the raspi)
sudo useradd username
sudo usermod -aG sudo username
Switch to the new user
create a .ssh folder in /home/<name>
2) Create a ssh key
(just enter everything. for local development don't use a passphrase otherwise you will have to enter the passphrase everytime. .. probably security overkill on your LAN)
4) On the raspi open an editor (e.g. nano or vim)
5) Copy & paste the .pub file content (you see with less) to the raspi authorized_keys
6) save the file as: /home/username/.ssh/authorized_keys
7) Install the remote development extension pack in VSCode on your development system.
8) Run Remote-SSH: Connect to Host... from the Command Palette (CTRL+SHift+P)
9) After you see that the connection is established just choose open file or open folder to open your development directory on the raspberry.