Last night, I was able to compile, download the code in a board and see the serial monitor in WSL 2 and PlatformIO as a Remote - WSL extension. 
It took me about ten hours to find my way, from installing Windows Insiders Preview (I wanted to see the WSL GUI apps support) to have a working system. My system isn’t stable yet and under some mysterious circumstances PlatformIO refuses to compile, but it’s already somewhat functional and I would like to register my path so someone can develop it further.
Requirements:
- VS Code already installed on Windows
- An existing project to test
Procedure:
- I installed Windows and WSL 2 with support for GUI apps as listed in this site.
- For USB connections, I instaled USBIP
2.1. in Windows: using the instructions here: GitHub - cezanne/usbip-win: USB/IP for Windows
2.2. in WLS2, using the instructions here: GitHub - rpasek/usbip-wsl2-instructions and mixing with the instructions here: Compiling Your Own Linux Kernel for Windows? WSL 2 – MicroHobby
For the time being, both instructions are outdated, but mixing them was enough to understand the process.
- Using USBIP, I tried to attach a serial USB port in WSL 2. The permissions in /dev/ttyUSB0 were wrong, so I fixed them temporarily with
sudo chmod 666 /dev/ttyUSB0
. In the future, configuring a rule for udev should fix this permanently. I tested it with putty and had successful results.
- I copied the Platform IO project folder to my WSL home folder
- I used the Remote - WSL VS Code extension to open the project folder in my WSL home folder.
- In remote VS Code, I installed the Platform IO extension.
The project compiled and was downloaded in the board as expected.
To create a new project, I had to create it in Windows, then move it to WSL.
Bugs: VS Code PlatformIO extension in Windows and in WSL seem to be sharing the same folder for the frameworks and compilers, so when I switch operating systems, I have to reinstall VS Code PlatformIO extension, but that doesn’t always work. I need to investigate further.