liximomo / vscode-sftp

Super fast sftp/ftp extension for VS Code
MIT License
1.5k stars 256 forks source link

Messing up on multiple configs on multiple profiles #795

Open DBangLab opened 4 years ago

DBangLab commented 4 years ago

Do you read the FAQ?

Describe the bug Having multiple projects located on different servers using the same workspace seems to message multiple sftp config profiles. ( see screenshots for example files )

To Reproduce VSCode is having both projects in one workspace. e.g. Projects

both of these projects has their own sftp.json config in their own .vscode folder and they are both having a dev and a live folder on the server. Workflow is like this: always save to dev version as default and then when everything is working as it should, switch and sync to live version.

Project A setup

Project A on local: d:/sftp/project-a
SFTP Config: d:/sftp/project-a/.vscode/sftp.json

{
    "name": "Project A",
    "defaultProfile": "project-a-dev",
    "profiles": {
        "project-a-dev": {
            "name": "Project A (Dev)",
            "host": "127.0.0.1",
            "port": 22,
            "protocol": "sftp",
            "username": "webmaster",
            "privateKeyPath": "~/.ssh/id_rsa",
            "remotePath": "/srv/sites/site.com/project-a-dev",
            "uploadOnSave": true,
            "ignore": [
                ".vscode",
                ".git"
            ]
        },
        "project-a-live": {
            "name": "Project A (Live)",
            "host": "127.0.0.1",
            "port": 22,
            "protocol": "sftp",
            "username": "webmaster",
            "privateKeyPath": "~/.ssh/id_rsa",
            "remotePath": "/srv/sites/site.com/project-a-live",
            "uploadOnSave": true,
            "ignore": [
                ".vscode",
                ".git"
            ]
        }
    }
}

Project B setup

Project B on local: d:/sftp/project-b
SFTP Config: d:/sftp/project-b/.vscode/sftp.json

{
    "name": "Project B",
    "defaultProfile": "project-b-dev",
    "profiles": {
        "project-b-dev": {
            "name": "Project B (Dev)",
            "host": "127.0.0.1",
            "port": 22,
            "protocol": "sftp",
            "username": "webmaster",
            "privateKeyPath": "~/.ssh/id_rsa",
            "remotePath": "/srv/sites/site.com/project-b-dev",
            "uploadOnSave": true,
            "ignore": [
                ".vscode",
                ".git"
            ]
        },
        "project-b-live": {
            "name": "Project B (Live)",
            "host": "127.0.0.1",
            "port": 22,
            "protocol": "sftp",
            "username": "webmaster",
            "privateKeyPath": "~/.ssh/id_rsa",
            "remotePath": "/srv/sites/site.com/project-b-live",
            "uploadOnSave": true,
            "ignore": [
                ".vscode",
                ".git"
            ]
        }
    }
}

sftp will "randomly" set a profile to be active instead of using current workspace folder root/.vscode/sftp.json and having the wrong profile seems to just report [07-07 10:28:00] [info] Using profile: project-b-dev when saving a file in project-a.

Expected behavior I except it to use the current workspace .vscode folder for reading which defaultProfile to use at current time, each project could be located on a different server (just in this example i am using localhost) but they are in the same workspace because maybe of the features are connected.

Screenshots https://filebin.net/pon549uo4pvv98zp

Desktop (please complete the following information):

Extension Logs from Startup - required

[07-07 10:13:47] [debug] register command "Cancel All Transfer" from "./commandCancelAllTransfer.ts"
[07-07 10:13:47] [debug] register command "Config" from "./commandConfig.ts"
[07-07 10:13:47] [debug] register command "List Active Folder" from "./commandListActiveFolder.ts"
[07-07 10:13:47] [debug] register command "Open Ssh Connection" from "./commandOpenSshConnection.ts"
[07-07 10:13:47] [debug] register command "Set Profile" from "./commandSetProfile.ts"
[07-07 10:13:47] [debug] register command "Toggle Output Panel" from "./commandToggleOutputPanel.ts"
[07-07 10:13:47] [debug] register command "Upload Changed Files" from "./commandUploadChangedFiles.ts"
[07-07 10:13:47] [debug] register command "Delete Remote" from "./fileCommandDeleteRemote.ts"
[07-07 10:13:47] [debug] register command "Diff" from "./fileCommandDiff.ts"
[07-07 10:13:47] [debug] register command "Diff Active File" from "./fileCommandDiffActiveFile.ts"
[07-07 10:13:47] [debug] register command "Download" from "./fileCommandDownload.ts"
[07-07 10:13:47] [debug] register command "Download Active File" from "./fileCommandDownloadActiveFile.ts"
[07-07 10:13:47] [debug] register command "Download Active Folder" from "./fileCommandDownloadActiveFolder.ts"
[07-07 10:13:47] [debug] register command "Download File" from "./fileCommandDownloadFile.ts"
[07-07 10:13:47] [debug] register command "Download Folder" from "./fileCommandDownloadFolder.ts"
[07-07 10:13:47] [debug] register command "Download Force" from "./fileCommandDownloadForce.ts"
[07-07 10:13:47] [debug] register command "Download Project" from "./fileCommandDownloadProject.ts"
[07-07 10:13:47] [debug] register command "Edit In Local" from "./fileCommandEditInLocal.ts"
[07-07 10:13:47] [debug] register command "List" from "./fileCommandList.ts"
[07-07 10:13:47] [debug] register command "List All" from "./fileCommandListAll.ts"
[07-07 10:13:47] [debug] register command "Reveal In Explorer" from "./fileCommandRevealInExplorer.ts"
[07-07 10:13:47] [debug] register command "Reveal In Remote Explorer" from "./fileCommandRevealInRemoteExplorer.ts"
[07-07 10:13:47] [debug] register command "Sync Both Directions" from "./fileCommandSyncBothDirections.ts"
[07-07 10:13:47] [debug] register command "Sync Local To Remote" from "./fileCommandSyncLocalToRemote.ts"
[07-07 10:13:47] [debug] register command "Sync Remote To Local" from "./fileCommandSyncRemoteToLocal.ts"
[07-07 10:13:47] [debug] register command "Upload" from "./fileCommandUpload.ts"
[07-07 10:13:47] [debug] register command "Upload Active File" from "./fileCommandUploadActiveFile.ts"
[07-07 10:13:47] [debug] register command "Upload Active Folder" from "./fileCommandUploadActiveFolder.ts"
[07-07 10:13:47] [debug] register command "Upload File" from "./fileCommandUploadFile.ts"
[07-07 10:13:47] [debug] register command "Upload Folder" from "./fileCommandUploadFolder.ts"
[07-07 10:13:47] [debug] register command "Upload Force" from "./fileCommandUploadForce.ts"
[07-07 10:13:47] [debug] register command "Upload Project" from "./fileCommandUploadProject.ts"
[07-07 10:13:47] [info] config at d:\sftp\project-b {"remotePath":"./","uploadOnSave":false,"downloadOnOpen":false,"ignore":[],"concurrency":4,"protocol":"sftp","connectTimeout":10000,"interactiveAuth":false,"secure":false,"remoteTimeOffsetInHours":0,"name":"Project B","defaultProfile":"project-b-dev","profiles":{"project-b-dev":{"name":"Project B (Dev)","host":"127.0.0.1","port":22,"protocol":"sftp","username":"webmaster","privateKeyPath":"~/.ssh/id_rsa","remotePath":"/srv/sites/site.com/project-b-dev","uploadOnSave":true,"ignore":[".vscode",".git"]},"project-b-live":{"name":"Project B (Live)","host":"127.0.0.1","port":22,"protocol":"sftp","username":"webmaster","privateKeyPath":"~/.ssh/id_rsa","remotePath":"/srv/sites/site.com/project-b-live","uploadOnSave":true,"ignore":[".vscode",".git"]}}}
[07-07 10:13:47] [info] config at d:\sftp\project-a {"remotePath":"./","uploadOnSave":false,"downloadOnOpen":false,"ignore":[],"concurrency":4,"protocol":"sftp","connectTimeout":10000,"interactiveAuth":false,"secure":false,"remoteTimeOffsetInHours":0,"name":"Project A","defaultProfile":"project-a-dev","profiles":{"project-a-dev":{"name":"Project A (Dev)","host":"127.0.0.1","port":22,"protocol":"sftp","username":"webmaster","privateKeyPath":"~/.ssh/id_rsa","remotePath":"/srv/sites/site.com/project-a-dev","uploadOnSave":true,"ignore":[".vscode",".git"]},"project-a-live":{"name":"Project A (Live)","host":"127.0.0.1","port":22,"protocol":"sftp","username":"webmaster","privateKeyPath":"~/.ssh/id_rsa","remotePath":"/srv/sites/site.com/project-a-live","uploadOnSave":true,"ignore":[".vscode",".git"]}}}
[07-07 10:13:58] [info] Using profile: project-a-dev
[07-07 10:14:12] [trace] run command 'Set Profile'

I UNSET the profile and then it doesn't seem to do anything at all.

DBangLab commented 4 years ago

if saving a file while having the other profile activated nothing is uploaded to the server.

dtw commented 1 year ago

I have this problem. I have five folders in my workspace. Each has it's own sftp.json. In each of those there is a "dev" and a "prod" Profile with "dev" set to default. Up until now this has worked perfectly.

Now I want to upload some files to "prod" in one folder, so I tried to Set Profile - it lists dev and prod for each folder (so 10 profiles). OK, I assume this is just because I gave them all the same name.

So, I renamed the Profiles in each sftp.json to {folder name}-dev and {folder name}-prod...

And now it becomes clear that Set Profile isn't set on a per folder/config basis. Because if I Set Profle folder-a-dev and switch to folder-b and try to Upload, it complains there is no Profile called folder-a-dev.

So, the fact it was working as expect before was pure fluke.

I now see that I could choose any one of the "dev" or "prod" Profiles I orginally had and SFTP will just look for a Profile with that name in the sftp.json of the current folder. Which is manageable but not all working as I'd expect.