Is it possible to use $ code.
in remote server ssh session just like I do in WSL
when I want to open current working directory in remote host in local VSCode?
ADDENDUM: In local WSL, I can issue $ code.
and that would open the current directory in VSCode which is installed on Windows 10.
I am trying to get the same behavior in another remote Linux which I have connected to remotely through ssh
. So when I am on that remote machine and issue $ code.
it would open that directory in VSCode installed on local window.
I don't imagine this would be simple to do but I certainly share your desire to want to be able to do it.
Here's an explanation of why it doesn't work, and a hint at why it's probably quite a difficult thing to setup:
The way code.
works from WSL (or PowerShell) is by launching VS Code in the given directory (passed as the first argument as the dot).
When you run code
from WSL it uses wslpath
to convert the path to the Windows accessible one, and the WSL magic executes code.exe
(which is, after all, a Windows binary and not a Linux one) in Windows with the WSL path ( \\wsl$...
);
In order for this to work you need to achieve three things:
code.exe
on your local machine, but from your remote terminalA couple of ideas you could play with if you wanted to try and implement it:
vscode://
URL for you to click (or find a way to get your client to auto-load it).Just some musings, It's not something I need enough to put any effort into it. but I came across your question looking for something else and found it interesting, Hope that's helpful to anybody, any thoughts/feedback is welcome!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.