2017-06-14 118 views
1

我刚开始在Visual Studio代码(Ubuntu 14.04)中使用PHP调试扩展。它主要适用于我,但我有一个问题,每次抛出异常时,调试器都会自动中断。我们有很多例外,这些例外在我们的代码中被内部捕获和处理,所以我不希望逐步解决这些问题。Visual Studio中的PHP调试代码中断每个异常

我一直试图找到在Visual Studio 2015年类似的Exception Settings,但无法找到的Visual Studio 代码内的任何等效选项。

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代码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"] 
     } 
    ] 
} 

需要注意的是,当我使用NetBeans具有相同Xdebug的设置和相同的代码调试,有没有打破异常行为,所以我认为这必须是Visual Studio Code和/或PHP Debug扩展中的一些东西。

任何人都可以建议如何通过例外没有打破?

回答

5

我刚刚找到答案(现在感觉有点蠢!)。

在Visual Studio Code中,转到View-> Debug,然后取消选中Breakpoints部分中的'Everything'按钮。该选项将自动在PHP声明,警告和例外中断。

enter image description here

相关问题