vscode-php-debug
vscode-php-debug copied to clipboard
Please add option to launch browser automatically when debug is starting
Hi,
PHP Debug extension is great. But please add an option to launch automatically the default browser, not just listening for xdebug.
So this section:
{ "name": "Launch currently open script", "type": "php", "request": "launch", "program": "${file}", "cwd": "${fileDirname}", "port": 9000 }
should lanunch not just in the debug console. but in real browser the currently open script.
Thank you very much!
In real browser the currently open script? How should the debugger know what URL maps to that script? This ist also not easy to get right cross-platform
Is it possible to launch a browser when just listening for XDebug, not running on the currently open script?
I assume it would be possible to open a browser with an empty tab.
I was thinking may something in the configuration where you can provide a URL for the application with the parameter to start Xdebug. So I could say I want the URL to be http://localhost and then it would open http://localhost?XDEBUG_SESSION_START=vscode in my default browser.
Are you aware that you don't need that query parameter?
I am using remote Xdebug through Vagrant. If I don't use that parameter, it doesn't seem to listen to anything.
So I am trying it out without the parameter and it does appear to be working now. I guess having the URL config is not necessary then.
@felixfbecker @skegel13 Has there been a solution for this?
There are options for this:
In case of Listen, you can use preLaunchTask
and reference a task in tasks, like this:
launch.json
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9000,
"preLaunchTask": "BROWSER"
},
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "BROWSER",
"type": "shell",
"windows": {
"command": "start http://localhost:1111"
}
}
]
}
This is windows specific, but can probably be adapted for osx and linux.
I'm leaving this open, so I can properly document this.
The other launch.json
key is serverReadyAction
...