WSL v.1 -- VSCode v1.40.1 (using \'Remote - WSL\' extension 40.3)
How to open a root-owned file for edit using sudo and VSCode? (without running as root)
Set environment variable:
export VISUAL="code -nw"
Then you can edit any file like this:
sudo -e file
It will automatically make a copy of file, and, when you close the editor, copy it back.