我刚开始在Visual Studio Code(Ubuntu 14.04)中使用PHP Debug扩展。它对我来说效果很好,但我有一个问题,每次抛出异常时,调试器会自动中断。我们有许多异常,这些异常在我们的代码中被内部捕获和处理,因此我不想逐步完成这些异常。
我一直在尝试在Visual Studio 2015中找到类似Exception Settings的东西,但在Visual Studio Code中找不到任何等效选项。
php.ini设置:
[debug]
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
Visual Studio Code launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000,
"args": ["some arguments"]
}
]
}
请注意,当我使用相同的xdebug设置和相同的代码库来使用Netbeans进行调试时,没有违反异常的行为,因此我认为这必须是Visual Studio Code和/或PHP Debug扩展中的内容。
谁能建议如何在不破坏的情况下通过异常?
我正在寻找这个问题的另一个答案
我的Composer依赖项中有断点,这使得调试变得非常烦人。
对于任何具有相同问题的人,可以在ignore
文件中设置属性launch.json
,并使用一系列glob模式来忽略PHP Debug扩展。
{
// 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": 9000,
"ignore": [
"**/vendor/**/*"
]
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000,
"ignore": [
"**/vendor/**/*"
]
}
]
}