Update: Notes On How to use WSL-remote with WSL2, and Ruby 3.0.0
I discovered a way of using VScode "natively" with WSL, in the sense that everything is done in WSL and VScode does that while working with windows.
With VScode installed, search for the "Remote - WSL" , and install that.
Hit Ctrl+Shift+P
and search for remote, you can create a new WSL remote session based on the distribution, like, ubuntu, etc.
Upon getting that setup, and you're up and running with WSL-remote, there are more things to do to get ruby up and running.
You use Ctrl+Shift+P
whenever you want to interact with WSL-remote
In the bash console for WSL-remote, install Ruby with RVM:
Install a couple rubygems, assuming you have RVM installed alongside ruby
Always done in new Ruby installations; updates system gems:
gem update --system
Formats code on save:
gem install rufo
This also installs Rubocop
gem install solargraph
rubocop -A
in any given directory will lint/format your code.
For extensions to install on VScode... When running in WSL-remote, you can choose
Be sure to install these extensions into your WSL remote distro in question:
VSCode Ruby](marketplace.visualstudio.com/items?itemName..) WSL - Remote (Work natively with WSL1/2) Ruby Solargraph (intellisense) rufo (Ruby formatter)
Restart VScode if you haven't already, and you should have a development environment for Ruby and WSL2
Also, remember: When working inside WSL, like in /home/aritywolf, you get a speed boost and file monitoring if and only if you work IN WSL, not say, /mnt/c -- a real gotcha for me.