SchoofsKelvin / vscode-sshfs

Extension for Visual Studio Code: File system provider using SSH
GNU General Public License v3.0
543 stars 36 forks source link

Support prompt for host field #217

Closed unional closed 3 years ago

unional commented 3 years ago

Allowing prompt for host field would enable us to use the config as a template to connect to similar devices with the same configuration.

I have dozens of these devices and right now I have to create a configuration for every one of them.

SchoofsKelvin commented 3 years ago

Fixed in 5c82692, should be live in the next version of the extension.

Mind that there are a few notes:

  1. If the extension reloads (e.g. the window reloads), you'll be reprompted for the host (this includes that, if there is no Workspace Folder present yet, adding one also reloads the window)
  2. If you remove the WF and there's a SSH terminal on the same connection, the connection stays alive. This makes it that if you re-add the WF (or another terminal for the same config), it'll reuse the existing connection.
  3. If you remove the WF and the window does not reload, the connection might stay alive for (at most) 10s (basically if you re-add the WF (or a terminal), it'll use the existing connection instead of prompting for a new host) (similar as to what happens in 2. about it reusing the non-idle-timed-out-yet previous connection)
unional commented 3 years ago

Thanks! 🎉

Once it is available, I'll test it out and give any feedback.

Thanks for the extension!

SchoofsKelvin commented 3 years ago

@unional I just updated the extension to v1.19.0 which includes the host field prompting. Extension Marketplace should allow you to update any moment now.

unional commented 3 years ago

image Seems like there is still no selection for <Prompt> yet. 🌷

unional commented 3 years ago

Found that in the Activity bar. It does pop up when I click on that one. But if I use SSH FS: Add as Workspace folder, it does not allow prompt. Saying <user>@undefined and not selectable.

Another suggestion, maybe adding the input HOST in the workspace folder would be great:

image

i.e. in this case: SSH FS - dev-device <hostname> (dev-device is the config name).

SchoofsKelvin commented 3 years ago

Which version were you on? Did your VSCode update the extension to 1.19.0 already at that point? Mind that I didn't add a <Prompt> option, but just went with "empty means prompt" (aside from when PuTTY is set to a session name) instead.

I'm using this configuration (as listed in my settings.json):

{
    "name": "prompt",
    "label": "Prompt",
    "agent": "pageant"
}

with the Host field just empty in the Settings UI, and this does does prompt me for both the host and username. (and since I selected "pageant" and have a key loaded of a server, if I enter the right host/user, it'll work just fine for me)

I did just made the Host field a dropdown with a <Prompt> option (f257584) which'll be live in v1.19.1, but leaving the Host field empty should also prompt for it. The only exception is that if PuTTY is set to a non-empty value different from <Auto-detect>, as in that case it'll try to find the given PuTTY session, then take the hostname from that. (but if PuTTY is set to <Auto-detect> and Host is empty, it'll still prompt)

unional commented 3 years ago

Hi, I was using 1.19.0. Will check out 1.19.1.

Thanks!