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 ddev xdebug toggle flag #3593

Closed
alesrebec opened this issue Feb 10, 2022 · 13 comments
Closed

Add ddev xdebug toggle flag #3593

alesrebec opened this issue Feb 10, 2022 · 13 comments

Comments

@alesrebec
Copy link

alesrebec commented Feb 10, 2022

Currently ddev xdebug commands allows the following flags:

ddev xdebug on|off|enable|disable|true|false|status

It can either enable, disable or return the status of the xdebug.
In practice when we need to use xdebug we turn it on and then turn it off when we don't need it any more.
Those are two separate commands when we run them in our terminal window.

A good DX would be to have a
ddev xdebug toggle
flag so it basically reads the current status of xdebug and inverts it.
We would then be able to use the same command like we are used with drush cr for example.

"ddev xdebug toggle" will also return the current new status after being executed.

@rfay
Copy link
Member

rfay commented Feb 10, 2022

Sounds fine. A PR against https://github.com/drud/ddev/blob/a57e03500f1ba96ac1bd456f922c236d6c20d06d/pkg/ddevapp/global_dotddev_assets/commands/web/xdebug would be easy to do and it's easy for you to test because you can just override the default command.

@alesrebec
Copy link
Author

Hi @rfay

Sorry for late reply.
I was looking at this file when I posted the issue and pulled the latest master but when I tried to build it locally by just running "make" I got an error:

building .gotmp/bin/linux_amd64/ddev from ./cmd/... ./pkg/...
pkg/ddevapp/assets.go:4:2: cannot find package "." in:
	/tmp/ddev/vendor/embed
pkg/archive/archive.go:10:2: cannot find package "." in:
	/tmp/ddev/vendor/io/fs
make: *** [Makefile:81: .gotmp/bin/linux_amd64/ddev] Error 1

So I'm missing the instruction how to successfully build it and replace the ddev executable I currently use system wise to try it out when I make the changes in xdebug bash file.
Could you point me in the right direction with this?

@rfay
Copy link
Member

rfay commented Feb 14, 2022

Somebody else hit that, not sure what's up with it, but

  • Make sure you have go 1.17
  • go mod vendor && go mod tidy

and see if that gets you farther. You also may want to use gitpod, which is all set up with everything you need.

Thanks for working on it!

You don't actually have to build ddev to test it, you can just work on the ~/.ddev/commands/web/xdebug (with #ddev-generated commented out) and then provide the result. However, since there's special test coverage for ddev xdebug it will be good to add to that test as well.

@alesrebec
Copy link
Author

Thanks for the tips @rfay

I updated go to 1.17.6 and ran go mod vendor and tidy but I still get the same error.
I might be better trying to work on the xdebug file directly but I don't see it in my commands/web folder?

 ales@mach  /tmp/ddev   master ±  go version  
go version go1.17.6 linux/amd64
 ales@mach  /tmp/ddev   master ±  make
building .gotmp/bin/linux_amd64/ddev from ./cmd/... ./pkg/...
pkg/ddevapp/assets.go:4:2: cannot find package "." in:
	/tmp/ddev/vendor/embed
pkg/archive/archive.go:10:2: cannot find package "." in:
	/tmp/ddev/vendor/io/fs
make: *** [Makefile:81: .gotmp/bin/linux_amd64/ddev] Error 1
 ✘ ales@mach  /tmp/ddev   master ±  ls -la ~/.ddev/commands/web/
total 44
drwxr-xr-x 2 ales ales 4096 Feb 14 15:54 .
drwxr-xr-x 5 ales ales 4096 Dec  3  2020 ..
-rwxr-xr-x 1 ales ales  223 Feb 10 15:38 artisan
-rwxr-xr-x 1 ales ales 2330 Feb 10 15:38 blackfire
-rwxr-xr-x 1 ales ales  392 Feb 10 15:38 drush
-rwxr-xr-x 1 ales ales  268 Feb 10 15:38 magento
-rwxr-xr-x 1 ales ales  412 Feb 10 15:38 README.txt
-rwxr-xr-x 1 ales ales  335 Feb 10 15:38 typo3
-rwxr-xr-x 1 ales ales  339 Feb 10 15:38 typo3cms
-rwxr-xr-x 1 ales ales  225 Dec  3  2020 wp
-rwxr-xr-x 1 ales ales  599 Feb 10 15:38 xhprof

@rfay
Copy link
Member

rfay commented Feb 14, 2022

It looks like you have an ancient version of ddev source. Could you please update to the current version? I think that will help.

@rfay
Copy link
Member

rfay commented Feb 14, 2022

It's no surprise that you don't have xdebug in your ~/.ddev/commands/web I guess. It got moved there in the alphas. In your (v1.18.2? ) version it's in the project .ddev/commands/web directory. But it hasn't changed any way I can remember, so you can experiment with it there.

@alesrebec
Copy link
Author

I do have the latest master in my /tmp/ddev folder as I cloned in from github after creating this task.

Locally, in projects, I use the latest release 1.18.2 and I see the xdebug file in the project (not home folder).
So this change to add the xdebug to home folder ~/.ddev is coming in one of the next releases?

Anyway I will try to work in the project's xdebug file later today.
Thanks!

@rfay
Copy link
Member

rfay commented Feb 15, 2022

Ah, sorry. I saw the /tmp/ddev path and thought it was a complaint from inside the container that we used to use for builds.

No idea what's going on with the build. If you just want to use gitpod, it's all set up there. But the path you're on is great.

@louis-cuny
Copy link

Yes indeed it would be great DX improvement.
Additionally, I would say it should be the default behavior of ddev xdebug

@rfay
Copy link
Member

rfay commented Jul 12, 2022

@louis-cuny
Copy link

@rfay
Sorry I will not have time before october

@rfay
Copy link
Member

rfay commented Aug 24, 2022

I'm going to close this for now; it's easy to test your update to the xdebug command by just editing it in ~/.ddev/commands/web and removing the #ddev-generated and getting it to do what you want, then you can submit it as a PR. Looking forward to the PR.

@GuySartorelli
Copy link
Collaborator

I've raised #5625 to add a toggle arg for the xdebug command.

stasadev added a commit that referenced this issue Dec 13, 2023
Co-authored-by: Stanislav Zhuk <stasadev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants