joelspadin / vscode-remote-x11

Visual Studio Code extension that sets the DISPLAY environment variable in remote workspaces
39 stars 9 forks source link

Read configuration from ssh_config #32

Open joelspadin opened 3 years ago

joelspadin commented 3 years ago

Using something like https://www.npmjs.com/package/ssh-config, we could read some settings such as the private key file so you don't have to set them again in vscode settings.

rcketscientist commented 3 years ago

I have the same issue in #31. I'll give this a quick stab tonight.

rcketscientist commented 3 years ago

Quick and dirty first pass. image

Connecting to user@192.168.5.45 port 22 via user@bastion port 22
Connecting to user@bastion port 22
using private key
Connection closed.
Connecting to user@192.168.5.45 port 22
using private key
Creating forwarding shell
Connection ready. Setting up display...
...
Display ready: localhost:10.0
x11 accept: 127.0.0.1

ssh-config is some js gobbledy-gook. It'll be very hard to cover edge cases. I'm going to time box (hours) pulling the fields automatically specifically for the Microsoft guide. I'm not sure how many other ways there are to skin this cat... ProxyCommand ssh.exe -q -W %h:%p bastion

I'm thinking of the following:

Remote X11.SSH: Prefer Config
Experimental: Use remoteX11.SSH.sshConfig over other settings

In the meantime let me know what you think of Remote X11.SSH.jumpHost. Little funky the compressed format, but the single field makes it a bit easier to check this "all or nothing".

joelspadin commented 3 years ago

For the SSH config setting, I think it makes sense to put it under an experimental setting like that.

I also think having everything for the jump host in one setting like that is fine, especially if that matches how you would set thing up on the command line. You can also set up a regex to validate the setting so it shows an error in the settings editor if it isn't formatted correctly (though the error message is often less than helpful because it just shows you the regex your setting fails to meet).

I've also done a little bit of work on merging the display and screen settings in a similar manner so that you can also set a host for the display but haven't finished testing that yet.

rcketscientist commented 3 years ago

I actually went to having the three discrete fields. Since there were multiple logic paths to the jump connect it was silly to creat that macro field in code.

However, I discovered quite a few bugs even with the limited surface here. I'll need to return to this early next week to bang out a few more kinks. I'd hold on reviewing it till then