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
docs: auto-enable/disable Xdebug when step debugging with VS Code #5771
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left two comments in regards of the wordmark and as already noted on Discord. The spellchecker is already green on the spellcheck step. xdebug
and DDEV
are listed in the spellcheckwordlist.txt. So technically that are two false positives? Shouldn't the spellchecker failed and required changes already? and the other detail on step-debugging.md is only a minor nitpick to make the wording consistent between the docs page and the json file. and overall a real handy approach. i've already successfully tested. works like a charm thank you!
Looks like it should be great. @ultimike could you please take a look? |
Looks very useful. I didn't test it out yet, but I do have some thoughts:
-mike |
@ultimike The extension already starts/stops XDebug and creates/updates the launch.json when you select "XDebug Enable" in the project so the functionality it's there and can be adjusted. We can update the extension to use this method and remove "XDebug Enable" from the menu (see secreenshot). I'll include this in the next update. |
Works well. Tested with VSCode |
@rpkoller I've re-requested your review to get this one transitioned to the "Approved" status. Thanks. Edit: also, it appears review from ddev/documentation is pending. Since this team is not public, is there someone else is that needs to be pinged specifically for review? |
@biati-digital if there's anything we need to change from the DDEV end when you look at this, just say so |
Nice work @jameswilson , thanks for this great contribution! |
Funnily enough, the first test with did with this in class was using Lando - but all worked as expected! |
Ooops, I missed the step of installing the tasks.json. Gotta read the docs! |
@rfay I also noticed that the VS Code extension integration seems incomplete, in that it installs (or updates?) the .vscode/launch.json with the preLaunchTask and postLaunchTask, but it doesn't install the new dependencies from .vscode/tasks.json. As you noted, it does work if you manually create the tasks.json but this is kind of a head scratcher that the extension tries to automate some of this but doesn't get it all. So maybe this does needs a follow-up? Who is/are the maintainers of the VS Code extension, and where should we file an issue? |
Thanks @jameswilson - Please file issue at https://github.com/ddev/vscode-ddev-manager |
Aha, someone already filed an issue for this a few weeks ago: |
@jameswilson The extension does create the tasks.json file. If it's not working for you maybe there's some kind of bug that I'm not able to replicate. We'll continue the conversation in the extension repo. (Please note that I'm currently busy with work so it could take me some time to reply) |
(in my case above I wasn't using the extension, I just didn't read the docs to know/remember about the tasks) |
The Issue
Turning Xdebug on and off with ddev is a cheap operation:
Cheap, but also expensive, in that I often forget to one or both of these tasks when Step Debugging with Visual Studio Code (docs).
It would be nice to automatically execute the shell command
ddev xdebug [on|off]
when starting and stopping the “Listen for Xdebug” command inside Visual Studio Code. This would remove extra steps, breaking context, as well as avoiding accidentally leaving it on after finishing a debugging session.How This PR Solves The Issue
This PR updates the Step Debugging docs for Visual Studio Code (docs) with the following:
.vscode/tasks.json
where theddev xdebug on|off
commands are housed.preLaunchTask
andpostDebugTask
step to the existing.vscode/launch.json
configuration snippet provided by docs.tasks.json
snippet file with DDEV docs from which to copy/paste the new configs.ddev xdebug on
.Manual Testing Instructions
1.- Setup
Follow the complete steps as modified in this PR, copied here for ease of use,
.vscode/launch.json
..vscode/tasks.json
.index.php
. If it isn’t solid red, restart.For step 2 and 3, use the following snippets, again copied from the PR here for ease of use:
.vscode/launch.json:
.vscode/tasks.json:
2.- Test
Between step 4 and step 5 confirm that Xdebug is off, by typing in your terminal
ddev xdebug status
(result should say "xdebug disabled").At step 5, confirm that VS Code's Terminal shows the following output, indicating that the step debugger was able to find and execute the task:
At step 6, confirm that VS Code hits the breakpoint set in index.php, and step debugging works, as normal. At this time you can also go manually check in terminal to confirm that Xdebug is on with
ddev xdebug status
(result should say "xdebug enabled").When finished step debugging, tap the red block to Stop debugging in VS Code. The Terminal window should display the following:
Finally, confirm that Xdebug is actually off, by manually typing into your terminal the following command:
ddev xdebug status
. The status should be disabled.Related Issue Link(s)
This came about in a support request thread on the Ddev Discord server:
https://discord.com/channels/664580571770388500/1203038681322102804
Related VS Code docs:
https://code.visualstudio.com/docs/editor/debugging#_launch-configurations
https://code.visualstudio.com/docs/editor/tasks#_custom-tasks
Release/Deployment Notes
Not applicable