So, after the (very) impressive demo by @richturn_ms during the Windows Developer Day – Creators Update, for the ones following WSL since some time now (if not from the beginning), there was this part that must have triggered the “wow” effect.
Now, I’m by no means what you can call a developer. Matter fact, I’m not a SysAdmin neither, just a simple hobbyist who likes to come with “special” ideas.
Back to our topic, after the “wow” effect faded away, I scratched my head a little bit as Rich was showing something that was normally forbidden!
Or was he? the way he performed the demo, was actually the “correct” way: from one OS to another using a standard protocol (SSH).
After some research, I found also a way for the ones of us that do not code in C++, however would like to modify files, directly from the WSL filesystem in the “correct” way also with VSCode (however, I guess other editors will also be able to apply this method).
So for the ones of you, who would like to open/create/update files with VSCode, just follow this small steps:
- Install Remote VSCode extension
- Edit your “User Settings” to enable the server to start automatically
- Bypass all the “SSH Tunneling” part, it will not be needed in our case
- Install Rmate for Bash (just perform the Quick Install commands)
- From WSL, run
$ rmate -H localhost mytextfile.txt
- Save your changes, and confirm that the change has been correctly applied:
$ ll mytextfile.txt
$ cat mytextfile.txt
And that’s all, this should allow you to edit single files when following howtos in Internet (think Go, Nodejs, etc..).