vscode sftp 本地目录设置问题


环境:win7 64位 vscode:1.46.1 问题描述:   使用vscode打开文件夹方式打开项目后,本地文件E:\www\mypro\a.txt 可以上传到远程服务器 /Dockerfile/remotepro/a.txt,   但是将此文件夹添加为工作区后,再保存文件自动上传,文件E:\www\mypro\a.txt 却上传到远程服务器的   /Dockerfile/remotepro/mypro/a.txt。多了一层目录mypro   下面可能是我们的一个sftp.json配置内容:
{
    "name": "My Server",
    "host": "47.8.8.34",
    "protocol": "sftp",
    "port": 22,
    "username": "afei",
    "password": "password",
    "remotePath": "/Dockerfile/remotepro/",
    "uploadOnSave": true
}
  解决: 这时我们需要设置下context配置为当前目录 mypro 或者 ../mypro 或者 www/mypro 均可以同步成功。  
{
    "name": "My Server",
    "host": "47.8.8.34",
    "protocol": "sftp",
    "port": 22,
    "username": "afei",
    "password": "password",
    "remotePath": "/Dockerfile/remotepro/",
    "uploadOnSave": true,
    "context":"mypro"
}

 其他配置参见官网:https://github.com/liximomo/vscode-sftp/wiki/config