Vscode-php-debug: "Add Configuration..." not displaying PHP as an option

Created on 29 Sep 2017  路  19Comments  路  Source: xdebug/vscode-php-debug

I'm not able to add a config for a PHP debug session as it's not showing up in the add config menu.

I'm on 1.16.0 and have php 7.1.5 installed. Also, PHP Debug is @ version 1.11.1

It might also be able to put a complete config in the docs with some indication of what is required and what is optional.

released

Most helpful comment

If you have already chosen a different debugger for the open folder then the PHP option will not appear again.

The PHP debugger option reappears if you delete the .vscode/launch.json file.

I came across this problem with a mixed source folder: python and php. I had already selected the python debugger.

The configurationSnippets patch would be helpful so that PHP always appears in the list like the Chrome and Node.js ones do.

All 19 comments

Having the same issue.

PHP Version => 5.6.31
xdebug support => enabled
Version => 2.5.5

PHP Debug => 1.11.1

ext-xdebug.ini:

[xdebug]
zend_extension="/usr/local/opt/php56-xdebug/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1

Feel free to do a PR to implement addConfigurationRequest

What caused the option to go away? In the interim of this being added back in the docs should probably be updated since it provides steps for the config that no longer function.

Not sure what you are talking about. This option was never implemented

Hmmm, so was VS Code taking care of some of the magic?

Up until now, I've been able to follow the docs for the plugin to add the config. The docs no longer match the interactions inside of VS Code.

https://github.com/felixfbecker/vscode-php-debug/blob/master/README.md#vs-code-configuration

This is specifically the section that no longer matches the interaction that would be expected after the plugin is installed.

Well seems like VS Code removed support for initialConfigurations:

https://github.com/felixfbecker/vscode-php-debug/blob/ed5a99d0d4a5e6840186c21890b7027901609b2e/package.json#L191-L206

@weinand is this a bug or was this removed on purpose? The initial config in the PHP adapter is not dynamic in any way so I never saw a reason to implement the RPC method for it

I'm on vacation at the moment, but there was no intention to remove support for the static "initialConfigurations" contribution.
@isidorn this should work. If not it is a regression we should fix.

VSCode still supports intialConfigurations being contributed as a json object and this works just fine for PHP (just tried it). More details here https://github.com/Microsoft/vscode/issues/33794

If I understand this issue correctly the problem is that the Add Configurations... does not propose PHP, however this is due to the fact that PHP is not contributing configurationSnippets. Here is an exampe how node is doing it https://github.com/Microsoft/vscode-node-debug/blob/master/package.json#L152

If the above is correct then would the following changes resolve this issue?

diff --git a/package.json b/package.json
index 07722dc..b000480 100644
--- a/package.json
+++ b/package.json
@@ -188,20 +188,28 @@
             }
           }
         },
-        "initialConfigurations": [
+        "configurationSnippets": [
           {
-            "name": "Listen for XDebug",
-            "type": "php",
-            "request": "launch",
-            "port": 9000
+            "label": "PHP: Listen for XDebug",
+            "description": "Start PHP Plugin listening for XDebug",
+            "body": {
+              "name": "Listen for XDebug",
+              "type": "php",
+              "request": "launch",
+              "port": 9000
+            }
           },
           {
-            "name": "Launch currently open script",
-            "type": "php",
-            "request": "launch",
-            "program": "${file}",
-            "cwd": "${fileDirname}",
-            "port": 9000
+            "label": "PHP: Launch currently open script",
+            "description": "Start PHP Plugin for currently open script",
+            "body": {
+              "name": "Launch currently open script",
+              "type": "php",
+              "request": "launch",
+              "program": "${file}",
+              "cwd": "${fileDirname}",
+              "port": 9000
+            }
           }
         ]
       }

Probably, try it out and see (you can just modify the package.json of a php extension on the fly and relaod vscode). As I read above @felixfbecker is open to PRs so feel free to submit one

I just checked on an empty project and the instructions as they are written in the README (click gear icon, select PHP) work completely fine, so I am going to close this issue.

I have this exact same issue on Linux (Ubuntu 18.10) using Visual Studio Code 1.30.2.

Clicking the cogwheel opens launch.json, which has this as the only contents:
{ // 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": [ { "type": "chrome", "request": "launch", "name": "Launch Chrome against localhost", "url": "http://localhost:8080", "webRoot": "${workspaceFolder}" } ] }

There is an Add Configuration...-button, but it only shows Chrome and NodeJS items.

I'm having this issue, too. Win 10 VS v 1.33.1

My Java debug extension displays suggested options, but it is not showing any for PHP.

I'm having this issue, too. Win 10 VS v 1.33.1

My Java debug extension displays suggested options, but it is not showing any for PHP.

I was having the same issue on openSUSE Leap 15.1 VS Code 1.36.1, the cogwheel was opening a launch.json file with some node.js debugging configuration without showing the PHP option.I had already installed the PHP Debug extension, so I deleted the .vscode directory from the project folder and restarted VS Code, now the cogwhell allowed me to select the PHP option which generated a new .vscode directory with the default PHP debugging options.

If you have already chosen a different debugger for the open folder then the PHP option will not appear again.

The PHP debugger option reappears if you delete the .vscode/launch.json file.

I came across this problem with a mixed source folder: python and php. I had already selected the python debugger.

The configurationSnippets patch would be helpful so that PHP always appears in the list like the Chrome and Node.js ones do.

this should be reopened.

I already had this fix on an unreleased branch. Because there things got complicated I created a new PR. It was based on #194.

:tada: This issue has been resolved in version 1.14.10 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bilogic picture bilogic  路  7Comments

johnbillion picture johnbillion  路  11Comments

herbertpimentel picture herbertpimentel  路  6Comments

luxifer picture luxifer  路  3Comments

andrews05 picture andrews05  路  10Comments