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

Name / label not shown when opening config via commandline #336

Open luckman212 opened 2 years ago

luckman212 commented 2 years ago

In #335 I figured out a workaround for opening configs and even specific remote filenames via commandline.

But, when doing it this way, the way the explorer tree is shown is different. Opening via VSCode GUI directly, the name of the config is shown, so you can identify what remote site it is, e.g.:

image

but, if that same config is opened via commandline:

code --reuse-window --folder-uri ssh://myhost1/

you get this generic "SSH FS": image

Is there any flag I can pass to make the opened config inherit the correct name? @SchoofsKelvin

luckman212 commented 2 years ago

I worked around it by hacking together a Bash script that outputs a /tmp/xxxxxxxx.code-workspace file with a stanza like this:

{
  "folders": [
    {
      "name": "SSH FS - MyHost1",
      "uri": "ssh://myhost1.foo.bar/"
    }
  ]
}
EOJ

then opening that with

open -b com.microsoft.VSCode /tmp/xxxxxxxx.code-workspace

it then inherits the correct name...

image

not sure if this is something that the extension could do better on its own but, works for me, for now 🙂

SchoofsKelvin commented 2 years ago

I could make the extension detect if there are any unnamed SSH FS workspace folders (for which VS Code uses a built-in<path> [SSH FS] name generator) on startup and immediately assign it the proper name. You'll have to activate this feature by specifying a custom flag though, as I imagine some people might actually prefer the show-the-root-path feature the built-in name generator has.

luckman212 commented 2 years ago

Sure, sounds good! For now, the workaround is working out ok for me. So, only if you think it'd be something useful to more than just me.