microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.62k stars 276 forks source link

Rename "Add New SSH Host..." #10221

Open PlethoraChutney opened 2 weeks ago

PlethoraChutney commented 2 weeks ago

In the "Remote-SSH: Connect to Host..." dialog, I'd like to suggest/request that the "Add New SSH Host..." option is renamed.

We recently had to change which node of a cluster we log into from node_a to node_b. To connect to node_b, 100% of VS Code users (including myself 🙃) clicked "Add New SSH Host..." and entered node_b. This causes VSC to add the useless lines

Host node_b
    HostName node_b

to the top of ~/.ssh/config, which breaks the existing config. Now users can't even SSH into node_b from the terminal, which was working before attempting to connect using VSC.

Users were all surprised to learn you could simply type node_b into the "Connect to Host..." dialog, and that this was not considered "adding a new host".

I think this confusion would be resolved if the dialog included a line like "Enter hostname" and a separate line named "Add new host to .ssh/config". The latter would have the functionality that's currently under "Add New SSH Host..."

Thank you!

roblourens commented 2 weeks ago

What is node_b, that's a hostname?

which breaks the existing config

How does it break the existing config?

roblourens commented 2 weeks ago

Or was it already an entry in the ssh config?

PlethoraChutney commented 1 week ago

Yes, sorry, that's a hostname. We have existing entries in the ssh config which correctly route hostnames matching a pattern through a login node, so adding an entry specifically matching that hostname prevents that routing from working.

PlethoraChutney commented 1 week ago

More explicitly, here's what's essentially in .ssh/config:

Host login
    HostName login.domain

Host node_*
    ProxyCommand ssh login -W %h:%p
    Hostname %h.domain

So adding the HostName lines breaks the -W routing through login.domain.

roblourens commented 1 week ago

Got it. This is a fairly common scenario but I've never been sure how to handle it. At times we've thought about trying to show Host entries with wildcards in the Remote Explorer, and do something like ask you for the full name when you click on it. Do you think that would help?

Maybe we could rename the command, have to say "Add New Host To SSH Config File" because the file can be in different locations, but then it doesn't seem specific enough to help with understanding.

Maybe https://github.com/microsoft/vscode-remote-release/issues/7801 is a good issue to link.

PlethoraChutney commented 1 week ago

Yes, I think that would probably help!

I think even simpler, though, it would go a long way to make it clear that you can type a hostname directly into the dialog to use its existing entry. I know this is outside your control, but other very similar looking dialogs (the python interpreter selection dialog comes to mind) require you to pick an option from the list or explicitly add one. I think this trains users (at least our users) to think of this type of dialog as an exhaustive list of options.

I know it says something to this effect in the text field itself: image but (and sorry for the incoming pedantry)

So, even though it would somewhat be a duplication of functionality, maybe adding an explicit option like "Connect by hostname" or something?

Thanks for taking this issue seriously! I know it's not broken per se, so I appreciate your time!