abstractable.io logo abstractable.io

VSCode and WSL

New options for #linonwin development

Cristian Southall

I’m a Consultant. My end-user computing use cases are therefore diverse. I connect to a variety of networks and exchange data with users of many enterprises, all of whom use a Windows Standard Operating Environment (SOE). I cannot avoid running Windows.

I’m also a Developer. I create code and automate infrastructure. I cannot avoid running Linux.

I have tried various ways to have my cake and eat it too: dual boot, virtual machines, docker, Windows Subsystem for Linux (WSL), Cygwin and the like. All of them create friction; most of them introduce problems to the development process.

I don’t expect any of these options to eliminate friction any time soon but a new option has emerged for #linonwin development: Visual Studio Code , the Remote Development VSCode extension and Windows Subsystem for Linux. Note that at the time of writing the Remote Development extension will only work on the ‘Insiders’ distribution of Visual Studio Code.

I’m still trialling this configuration and am yet to determine how much friction the approach introduces to the development process but I can say it has solved some problems. Specifically, it solved an issue I had with VSCode detecting changes to Git-controlled files when there were none. This was due to poor handling of line endings and resulted from VSCode using the Windows Git executable, not the WSL Git executable. Now, with the Remote Development extension, VSCode uses the same Git executable in the GUI as I use from the WSL shell (either inside or outside VSCode).

Addendum (7/7/2019)

WSL does not support GUI applications so you may still be inclined to use version control tools such as GitKraken from Windows. If so, these tools may report all files in your repo as ‘changed’ when the are not. Assuming you are handling line endings correctly, the cause will be a detected difference in the file permissions. You can avoid this by setting git config core.fileMode false.

Further Reading

  • Further information on the Remote Development plugin for VSCode can be found in this blog post

Issues

  • You cannot push from the VSCode GUI to remote origins if you use password-protected, certificate-based authentication. VSCode does not support password entry and so the push operation will hang. The workaround is to push from the WSL shell in the terminal window.

Powered by Jekyll; inspired by jekyll-swiss.