Introducing Visual Studio Code Remote
One way of working with files from a WSL distro's file system is to open them using the \\wsl$
share that WSL provides (as discussed in Chapter 4, Windows to Linux Interoperability, in the Accessing Linux files from Windows section). For example, I can access the wsl-book
folder from my home directory in the Ubuntu-20.04 distribution via \\wsl$\Ubuntu-20.04\home\stuart\wsl-book
. However, while this works, it incurs the cost of Windows-to-Linux file interop and doesn't provide me with an integrated environment.
On Windows, if we have Python installed along with the Python extension for Visual Studio Code, then we get an integrated experience for running and debugging our code. If we open code via the \\wsl$
share, then Visual Studio Code will still give us the Windows experience, rather than using the installation of Python and its dependencies and tools from WSL. However, with the Remote-WSL extension from Microsoft, we can fix that...