Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add regex patterns for PHP tracebacks so that line number is detected. #961

Open
Poikilos opened this issue May 20, 2024 · 1 comment

Comments

@Poikilos
Copy link

Poikilos commented May 20, 2024

When clicking a file in a PHP traceback, the file path is processed but not the line number.

This issue (and related API hook) is difficult to find online do to very common keywords in my issue like "line number". I would like there to be a handler to add new regex to the Debug Console. I would expect a debug handler to be the best place for this to be implemented, so VSCode PHP Debug seems like the best place to request the feature. However, I have working regex that would fix the issue (demonstrated using an extension for handling links in files, not the debug console (yet)):

If you have any info, please explain how to handle and manipulate links in the Debug Console. Perhaps dlevs would implement the feature there or I would help program the feature here or there.

PHP version: 8.2.18
Xdebug version: 3.3.2,
VS Code extension version: 1.34.0

Everything below can basically be ignored, since it is not relevant and the issue can be reproduced with a working Xdebug configuration any PHP script that has an error in it.

Your launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 0,
            "runtimeArgs": [
                "-dxdebug.start_with_request=yes"
            ],
            "env": {
                "XDEBUG_MODE": "debug,develop",
                "XDEBUG_CONFIG": "client_port=${port}"
            }
        },
        {
            "name": "Launch Built-in web server",
            "type": "php",
            "request": "launch",
            "runtimeArgs": [
                "-dxdebug.mode=debug",
                "-dxdebug.start_with_request=yes",
                "-S",
                "localhost:0"
            ],
            "program": "",
            "cwd": "${workspaceRoot}",
            "port": 9003,
            "serverReadyAction": {
                "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
                "uriFormat": "http://localhost:%s",
                "action": "openExternally"
            }
        }
    ]
}

Xdebug php.ini config: zend_extension = xdebug

Xdebug logfile (from setting xdebug.log in php.ini): N/A (any working configuration)
VS Code extension logfile (from setting "log": true in launch.json): N/A (any working configuration)

Code snippet to reproduce:
Any PHP file with errors

@zobo
Copy link
Contributor

zobo commented May 20, 2024

Hi!

I don't think this can be done in the Debug Adapter, but I'll look around in this is somehow extendable. We can open an issue with vscode if it is not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants