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

"Add Configuration..." not displaying PHP as an option #191

Closed
ghost opened this issue Sep 29, 2017 · 19 comments · Fixed by #527
Closed

"Add Configuration..." not displaying PHP as an option #191

ghost opened this issue Sep 29, 2017 · 19 comments · Fixed by #527
Labels

Comments

@ghost
Copy link

ghost commented Sep 29, 2017

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.

@dparkerfmts
Copy link

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

@felixfbecker
Copy link
Contributor

Feel free to do a PR to implement addConfigurationRequest

@ghost
Copy link
Author

ghost commented Oct 4, 2017

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.

@felixfbecker
Copy link
Contributor

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

@ghost
Copy link
Author

ghost commented Oct 4, 2017

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.

@ghost
Copy link
Author

ghost commented Oct 4, 2017

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.

@felixfbecker
Copy link
Contributor

felixfbecker commented Oct 4, 2017

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

@weinand
Copy link

weinand commented Oct 4, 2017

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.

@isidorn
Copy link

isidorn commented Oct 5, 2017

VSCode still supports intialConfigurations being contributed as a json object and this works just fine for PHP (just tried it). More details here microsoft/vscode#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

@dparkerfmts
Copy link

dparkerfmts commented Oct 5, 2017

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
+            }
           }
         ]
       }

@isidorn
Copy link

isidorn commented Oct 5, 2017

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

blockscoped added a commit to blockscoped/vscode-php-debug that referenced this issue Oct 5, 2017
When selecting `Add Configuration` in a VS Code launch.json file PHP is no longer shown as an option. The new `configurationSnippets` resolves this.
blockscoped added a commit to blockscoped/vscode-php-debug that referenced this issue Oct 5, 2017
When selecting `Add Configuration` in a VS Code launch.json file PHP is no longer shown as an option. The new `configurationSnippets` resolves this.
@felixfbecker
Copy link
Contributor

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.

@DoogeJ
Copy link

DoogeJ commented Jan 22, 2019

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.

@paoramati
Copy link

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.

@pablovca
Copy link

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.

@primaeval
Copy link

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.

@Spongman
Copy link

this should be reopened.

zobo added a commit that referenced this issue Mar 23, 2021
…nfiguration` in a VS Code launch.json file PHP is no longer shown as an option. The new `configurationSnippets` resolves this.
zobo added a commit that referenced this issue Mar 23, 2021
Fixes #191. Add Configuration doesn't show PHP when selecting `Add Configuration` in a VS Code launch.json file PHP is no longer shown as an option. The new `configurationSnippets` resolves this. (#527)
@zobo
Copy link
Contributor

zobo commented Mar 23, 2021

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

@github-actions
Copy link

🎉 This issue has been resolved in version 1.14.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

10 participants