vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

Remote targets order is not determined by my ssh config

Open jiangtann opened this issue 1 year ago • 5 comments

I place Host M on the top of my ssh config file, however, Host M is at the bottom of ssh remote target list: image

After I change the name of Host M to 123 and click the flush button, it moves to the top: image

And I change the name of Host 123 to 123123 and click the flush button, it moves to the bottom again: image

Why my remote targets order is not determined by my ssh config? What is the reason for this situation? Refs: https://github.com/microsoft/vscode-remote-release/issues/4808

jiangtann avatar May 09 '24 19:05 jiangtann

Thanks for filing. I'm unable to reproduce this on the latest VS Code Insiders and Remote-SSH pre-release extension. Are you on the latest versions of both?

bamurtaugh avatar May 31 '24 16:05 bamurtaugh

My environment:

macOS: 12.7.2    Apple M1 Pro silicon
Version: 1.89.1 (Universal)
Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685
Date: 2024-05-07T05:14:24.611Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 21.6.0

Remote - SSH: v0.112.2024053015 (pre-release)
Remote Explorer: v0.5.2024052909 (pre-release)

I reproduce this on another intel macbook, and its information is as follows:

macOS: 12.7.2    Intel Core i7
Version: 1.89.1 (Universal)
Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685
Date: 2024-05-07T05:14:24.611Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin x64 21.6.0

Remote - SSH: v0.112.2024053015 (pre-release)
Remote Explorer: v0.5.2024052909 (pre-release)

I found that the hosts are arranged in the following patterns:

  • Normal number Host (e.g. 123, 22222 etc.) is always ranked ahead of other Host (e.g. M, 1.2, 02222 etc.)
  • If there are multiple normal number Host, they are arranged in order of size. For example, Host 22226 is always ranked ahead of Host 123123, regardless of their order in ~/.ssh/config.
  • If there are multiple other Host, they are arranged according to the order in the ~/.ssh/config.

jiangtann avatar Jun 05 '24 07:06 jiangtann

@bamurtaugh Accroding to my info, can you repeat the patterns I mentioned above? Thanks for your work.

jiangtann avatar Jun 05 '24 07:06 jiangtann

Hmm maybe this is macOS specific? I don't have a mac to test, perhaps @roblourens will have other insights / be able to repro.

bamurtaugh avatar Jun 05 '24 16:06 bamurtaugh

Seems like this happens for just numeric Host names, and seems to be because we use Object.keys on an object which usually returns keys in insertion order but for numeric keys (even a string of numbers) those get sorted to the top

roblourens avatar Jun 07 '24 17:06 roblourens