The Plug.Debugger
docs describe setting the PLUG_EDITOR
environment variable to generate links to your text editor.
Unfortunately the example given, vscode://file/__FILE__:__LINE__
, won’t work when the development environment is structured as:
- Windows host browser, as tested in Chromium-based Edge and Opera GX, and Firefox
- Windows VSCode with Visual Studio Code Remote - WSL extension
- Files in WSL distro
The VSCode docs Developing in WSL show how to force open a file from the windows command prompt
code --file-uri vscode-remote://wsl+Ubuntu/home/ubuntu/fileWithoutExtension
but the browser complains that vscode-remote://
is not a registered protocol.
What does work is the format suggested in Issue #108257 · microsoft/vscode, exporting the envar before starting the dev server in either the integrated terminal or your favourite external terminal.
export PLUG_EDITOR=vscode://vscode-remote/wsl+[DISTRO]__FILE__:__LINE__
iex -S mix phx.server
Replace [DISTRO]
with your distro’s name, e.g. wsl+Ubuntu
, and note there is no /
between it and __FILE__
Happy debugging