I was looking for a way to get the applications already installed on WSL(Windows Subsystem LInux), while working on a PHP app.
I wanted to use the PHP formatter but VScode wanted me to install PHP executable on windows, but I had already done that in WSL(so installing it on windows again, violates the DRY principle 🙂 )
Using something like this, in user settings
"phpformatter.phpPath": "wsp php",
unfortunately didn’t work.
A workaround is to create a bat file(let’s call it php.bat):
@echo off set v_params=%* set v_params=%v_params:\=/% set v_params=%v_params:c:=/mnt/c% set v_params=%v_params:"=\"% bash.exe -c "php %v_params%"
and in your user settings file add:
Replace X: with your drive letter like C: or D:
That’s it! PHP formatter should now work, atleast untill VScode makes some official update, allowing easy inter-operations with the wsl environment.
You can find more details for better wsl setup at this link(source of this post).