Jump to content

Tutorial: Enable TracyDebugger to open files in WSL2


dotnetic
 Share

Recommended Posts

When you encounter a bardump output or errors in TracyDebugger, a link typically appears below the message, allowing you to open the file and line where the output occurred, with VSCode as the default editor.

image.png.8dbd481552d0c9951e7d75199cc29be1.png

However, in a Windows WSL2 environment, this feature doesn’t work by default.

To enable these links, add the `editor` and `localRootPath` variables to the TracyDebugger module's config or in your `site/config-dev.php` (or site/config.php).

Here’s an example in my config-dev.php that works for me. Make sure to use `vscode://vscode-remote/wsl+nameOfYourDistro/pathToYourFiles/%file:%line`. This establishes a remote connection to the selected Linux distro.

$config->tracy = array(
  'frontendPanels' => array('mailInterceptor', 'panelSelector'),
  'nonToggleablePanels' => array('mailInterceptor', 'tracyToggler'),
  'outputMode' => 'DEVELOPMENT',
  'forceIsLocal'  => true,
  'guestForceDevelopmentLocal' => true,
  'editor' => 'vscode://vscode-remote/wsl+Ubuntu22.04/home/jmartsch/htdocs/fugamo/fugamo-shop/%file:%line',
  'localRootPath' => 'dist/',
  'backendPanels' => array(
//    'processwireInfo',
//    'requestInfo',
//    'processwireLogs',
//    'tracyLogs',
//    'methodsInfo',
//    'debugMode',
//    'console',
    'mailInterceptor',
    'panelSelector',
    'tracyToggler'
  ),
);

Now you can click on the filename, and get directly to the corresponding line.

  • Like 3
  • Thanks 2
Link to comment
Share on other sites

  • 1 month later...

Thanks for the tutorial @dotnetic

On 11/5/2024 at 1:20 PM, dotnetic said:
 'editor' => 'vscode://vscode-remote/wsl+Ubuntu22.04/home/jmartsch/htdocs/fugamo/fugamo-shop/%file:%line',

In case someone runs into an issue I had, my Ubuntu 22.04 is the default distro in my WSL2. Hence, I did not need to enter the 22.04 part in my editor path (just '...vscode-remote/wsl+Ubuntu/rest/of/path/'. In fact, doing so leads to an error 'distro not found' (opens in a new VSCode window too).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...