Search code examples
phpvisual-studio-codexdebugvisual-studio-debugging

How to configure xdebug stacktrace to link to and open files in VS Code


When xdebug provides a stacktrace, it can create links to open files in your text editor at a particular line. For instance, the following configuration will open files in Sublime, if the subl handler is installed:

xdebug.file_link_format="subl://open?url=%f&line=%l"

How does one set file_link_format for VS Code?


Solution

  • Here's the documentation of the URL format for VS Code.

    Thus, the xdebug config is:

    xdebug.file_link_format="vscode://file/%f:%l"