Create the workspace
This is the approach we use, to ensure that the .vscode folder with config settings, sftp logging details, etc is not part of the httpdocs\ (or similar) folder that is published on the web server.
In VS Code open the folder that CONTAINS you local httpdocs\ (or whatever you call it) folder that contains all the web site folders and files (don’t open httpdocs\ itself, open the folder 1 level above it, that contains it)
File > Save Workspace As…
Save it to the working folder
Configure the SFTP extension
Ctrl+Shift+P to open command palette > SFTP: config
A basic configuration file will be created named sftp.json under the .vscode directory.
You need to add this line to it, to handle your httpdocs\ folder not being the root folder of the vscode workspace (adjust httpdocs to whatever you folder is called if it is different):
"context": "httpdocs/",
Now edit the config with the configuration parameters for your remote server connection.