Issue Task Closed

#106218Make copy/paste from the backtrace page to the IDE more comfortable

Christian Toffolo 02/20/25, 08:08 updated 11/10/26, 20:09

Description

In the backtrace page shown by the debug exception handler, the format that displays the filename and the line could be improved from:
@in /var/www/TEST/TYPO3.CONF/ext/bootstrap_package/ext_localconf.php line 3@
to:
@/var/www/TEST/TYPO3.CONF/ext/bootstrap_package/ext_localconf.php:3@
So, with a triple-click, one can select that line and then copy and paste it in the “Find in files” feature of an IDE (VSCode; PhpStorm; etc…) then press ENTER and be positioned, in the IDE, in that specific line.

The code is here:
https://github.com/TYPO3/typo3/blob/21d14b34dc9161cef5058560291d5a7ed5a7d6b4/typo3/sysext/core/Classes/Error/DebugExceptionHandler.php#L480

Change from:

    protected function formatPath(string $path, int $line): string
    {
        return sprintf(
            '<span class="block trace-file-path">in <strong>%s</strong>%s</span>',
            $this->escapeHtml($path),
            $line > 0 ? ' line ' . $line : ''
        );
    }

to:

    protected function formatPath(string $path, int $line): string
    {
        return sprintf(
            '<span class="block trace-file-path"><strong>%s</strong>%s</span>',
            $this->escapeHtml($path),
            $line > 0 ? ':' . $line : ''
        );
    }

Maybe here too: https://github.com/TYPO3/typo3/blob/21d14b34dc9161cef5058560291d5a7ed5a7d6b4/typo3/sysext/core/Classes/Error/ErrorHandler.php#L139

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 4

  1. Garvin Hicking commented and changed category <span data-processor="relativetime" data-value="2025-02-20T09:24:57+00:00" > 02/20/25, 09:24 </span>

    While I understand the notion the problem is that lesser skilled developers might need that extra info that “:xx” refers to a line number.
    Also, it would make copy&paste harder for doing a “git log” or so with the URL.

    I think the best solution would be to introduce a “copy” button that uses the “x:y” format and puts it into your clipboard, and leaving the display unchanged.

    What do you think?

  2. Christian Toffolo commented <span data-processor="relativetime" data-value="2025-02-20T09:28:56+00:00" > 02/20/25, 09:28 </span>

    Garvin Hicking wrote in #note-1:
    > Also, it would make copy&paste harder for doing a “git log” or so with the URL.

    I didn’t get this part but the “copy” button solution is perfect!

  3. Georg Ringer commented and changed status New Closed <span data-processor="relativetime" data-value="2026-11-10T20:09:15+00:00" > 11/10/26, 20:09 </span>

    a copy path icon is available, it copies the path as typo3/sysext/styleguide/Classes/Controller/ComponentsController.php:315 to the clipboard – tested in the styleguide