Natizyskunk / vscode-sftp

Super fast sftp/ftp extension for VS Code
Other
373 stars 68 forks source link

Cannot add multiple hosts at the same time. #355

Open lizheng2018CC opened 1 year ago

lizheng2018CC commented 1 year ago

I added multiple hosts in my JSON file, but there is no option to select which host to use when I clicked "Upload File" option. I hope it could allow me to add multiple hosts, just like in PyCharm. When I upload a file, there should be a list of hosts popping up for me to choose from, or I can use the default host.

My sftp.json like this:

[
    {
        "name": "80",
        "host": "10.200.255.80",
        "protocol": "sftp",
        "port": 22,
        "username": "root",
        "remotePath": "/home/xxx/",
        "uploadOnSave": false,
        "useTempFile": false,
        "openSsh": false,
    },
    {
        "name": "38",
        "host": "10.200.255.38",
        "protocol": "sftp",
        "port": 22,
        "username": "root",
        "remotePath": "/home/xxx/",
        "uploadOnSave": false,
        "useTempFile": false,
        "openSsh": false,
    }
]
satiromarra commented 1 year ago

@lizheng2018CC This is because there can only be 1 connection per context (local directory), in this case the 2 connections refer to the same context/directory “.”

If you need to have a second connection for the same context/directory, try a profile.

scd10 commented 1 year ago

Is it possible to automatically upload a active file to multiple hosts when saving? I knew I can do this by command, but it still needs extra key strikes which I want to avoid.

huthl commented 1 year ago

Could you solve the problem, if you have 2 connection with context, that I can't upload on save. At the moment is it not possible to save to remote when more than one server was set up.

[
    {
        "name": "Server1",
        "host": "10.200.255.80",
        "protocol": "ftp",
        "port": 21,
        "username": "root",
        "remotePath": "/home/xxx/",
        "uploadOnSave": false,
        "useTempFile": false,
        "openSsh": false,
        "context":"../test1"
    },
    {
        "name": "Server2",
        "host": "10.200.255.38",
        "protocol": "sftp",
        "port": 21,
        "username": "root",
        "remotePath": "/home/xxx/",
        "uploadOnSave": false,
        "useTempFile": false,
        "openSsh": false,
        "context":"../test2"
  }
]
satiromarra commented 12 months ago

@huthl If the directories are at the root of the project, you don’t need to put “../“, directly “test1”

huthl commented 12 months ago

Hi, it's not working.

I have tested with

"context":"test1"

After close VS I don't get any file content. The files size in the test folder is 0kB. As mentioned if only one server is configured, everything is Ok. When a second server is new configured it works till SFTP hangs. After close and reopen VS the described behaviour of non working file editing isn't possible anymore.

following was logged and SFTP is hanging since the moment. [07-06 13:49:57] [info] remote ➞ local c:\Users.....\VS_Code\test1\site\wwwroot\info.php

satiromarra commented 12 months ago

@huthl And reinstalling version 1.16.1 works for you?

Natizyskunk commented 12 months ago

@huthl as @satiromarra just said, could you try 1.16.1 and let us know if it has fixed your problem please ?

huthl commented 11 months ago

Sorry for late answer

other versions aren't working too. Following detailed behaviour

first open file info.php --> edit file and save --> all right close file info php in editor by clicking x double click info.php -> I can see remote ➞ local ***\Programmieren\VS_Code\test2\site\wwwroot\info.php' but the content after open is empty

Sometimes SFTP hangs with infinite circular progress in statusbar and i've to close VS code complete.

Hope that helps. Tell me if I can contribute.

These are the associated logs:

'[07-26 09:55:29] [info] config at \Programmieren\VS_Code\test2 {"remotePath":"/","uploadOnSave":true,"useTempFile":false,"openSsh":false,"downloadOnOpen":false,"ignore":[],"concurrency":4,"protocol":"ftp","connectTimeout":5000,"interactiveAuth":false,"secure":false,"remoteTimeOffsetInHours":0,"remoteExplorer":{"order":0},"name":"Azure Staging","host":"","port":21,"username":"**","password":"**","context":"test2"} [07-26 09:55:29] [info] config at \Programmieren\VS_Code\test1 {"remotePath":"/","uploadOnSave":true,"useTempFile":false,"openSsh":false,"downloadOnOpen":false,"ignore":[],"concurrency":4,"protocol":"ftp","connectTimeout":5000,"interactiveAuth":false,"secure":false,"remoteTimeOffsetInHours":0,"remoteExplorer":{"order":0},"name":"Azure Staging test2","host":"","port":21,"username":"**","password":"**","context":"test1"} [07-26 09:56:07] [info] remote ➞ local \Programmieren\VS_Code\test2\site\wwwroot\info.php [07-26 09:56:37] [info] [file-save] \Programmieren\VS_Code\test2\site\wwwroot\info.php [07-26 09:56:37] [info] Don't Support MFMT [07-26 09:56:37] [info] local ➞ remote \Programmieren\VS_Code\test2\site\wwwroot\info.php [07-26 09:56:45] [info] remote ➞ local \Programmieren\VS_Code\test2\site\wwwroot\info.php'

huthl commented 11 months ago

This is the debug log after closing editor of info.php and doubleclick on info.php which will download the file and has no content (is empty) after reopen

'[07-26 10:49:18] [trace] run command 'Edit In Local' [07-26 10:49:18] [trace] handle download file for *\vscode-sftp\test2\site\wwwroot\info.php [07-26 10:49:18] [debug] < '226 ftp://**//site/wwwroot/info.php Transfer complete, AV test passed, download(company:,7/26/2023:10:49:19)\r\n' [07-26 10:49:18] [debug] > PASV [07-26 10:49:18] [debug] < '227 Entering passive mode (20,79,186,79,64,191)\r\n' [07-26 10:49:18] [debug] > LIST /site/wwwroot [07-26 10:49:18] [debug] < '150 Opening BINARY mode data connection.\r\n' [07-26 10:49:18] [debug] < '226 ftp://*//site/wwwroot Transfer complete, (company:***, 7/26/2023:10:49:19)\r\n' [07-26 10:49:18] [debug] > MODE S [07-26 10:49:18] [debug] < '200 Mode S ok.\r\n' [07-26 10:49:18] [debug] > ABOR [07-26 10:49:18] [info] remote ➞ local ***\vscode-sftp\test2\site\wwwroot\info.php [07-26 10:49:22] [debug] > NOOP [07-26 10:49:22] [debug] < '200 noop command successful.\r\n'