8000 Is it possible to make xdebug.file_link_format work from a VM · Issue #14340 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

Is it possible to make xdebug.file_link_format work from a VM #14340

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

Closed
dupuchba opened this issue Apr 13, 2015 · 16 comments
Closed

Is it possible to make xdebug.file_link_format work from a VM #14340

dupuchba opened this issue Apr 13, 2015 · 16 comments

Comments

@dupuchba
Copy link
Contributor

Hi all,

I am actually using vagrant @work and I just discover the magic with xdebug.file_link_format which work well outside my vagrant.

Here is my problem, when I trie to click on the debug tool bar on my controller name to be redirected IDE, It open my IDE but with my vagrant's path like this :

capture_d ecran_2015-04-13_a_18_33_18

It seems quite normal to me, as I am using a VM.

My question :

Is there a way to rewrite the path that I give to my ide ?

@stof
Copy link
Member
stof commented Apr 13, 2015

AFAIK, no

@dupuchba
Copy link
Contributor Author

Maybe @nicolas-grekas has an answer :-) ?

@nicolas-grekas
Copy link
Member

Using ini_set in your front controller?

@dupuchba
Copy link
Contributor Author

yes, a little too much IMO
What about modifying src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig by adding a configurable option ?

@derrabus
Copy link
Member

Maybe path mapping is rather a problem that JetBrains should solve. For remote debugging, they have solved this already, so maybe it's not a hard thing for them to extend this feature to those links.

@dupuchba
Copy link
Contributor Author

@derrabus I use phpstorm but the problem is the same with sublime text or any other IDE

@derrabus
Copy link
Member

@dupuchba Sure, and you use Symfony, but the problem is the same with Wordpress or Zend Framework.

My point is that this mapping is something very specific to your development environment. Another developer of your team probably needs different path mapping settings. This is why I'd rather implement such a feature into the IDE than into an application framework.

@BlueM
Copy link
BlueM commented Apr 19, 2015

According to your screenshot, you are on OS X. In that case, a pretty simple solution is to use a custom URL scheme which acts as a wrapper around a URL using xdebug.file_link_format. The most simple way to implement the wrapper code is an AppleScript bundle (maybe 20 lines of code, plus a few lines in Info.plist), but in case you’re familiar with Cocoa, you can also use that.
This approach is of course not as fast as the direct link (takes 2 or 3 seconds longer), but works well, and I’ve done this myself when I worked on a project inside a Vagrant VM a few years ago. The only restriction is that you must be able to set xdebug.file_link_format inside the VM to make it use your custom URL scheme.

@dupuchba
Copy link
Contributor Author

@BlueM Ty for the solution but IMO that's more an "hack" than a real solution for my problem (my co-workers have exactly the same issue on ubuntu).

@nicolas-grekas
Copy link
Member

Maybe with the Remote Call plugin?
https://plugins.jetbrains.com/plugin/6027?pr=phpStorm

See https://gist.github.com/amenk/5900852 also

@vincecore
Copy link

I made a bundle with a quick fix, it's not a good solution but works for now. I only tested it with the symfony IDE configuration, not with the xdebug feature.

https://github.com/vincecore/IdeLinkBundle

@hacfi
Copy link
Contributor
hacfi commented May 24, 2015

Using LinCastor on OS X I added a schema called pstormv (v for vagrant) and use the following shell script:

#!/bin/sh

REGEX="^url=file://(.*)&line=(.*)$"

if [[ $URL_QUERY =~ $REGEX ]]; then
    osascript -e "tell application \"PhpStorm\" to activate"
    /usr/local/bin/pstorm "${BASH_REMATCH[1]/\/var\/www\/current/\/Users\/me\/src\/project}:${BASH_REMATCH[2]}"
    exit 0
fi

exit 1

My project at /Users/me/src/project/ is mounted at /var/www/current in the vm.

@nicolas-grekas
Copy link
Member

For Ubuntu this is the same: a few tweaks to the /usr/local/bin/xdebug-urlhandler as defined in http://blog.lyrixx.info/2013/02/05/how-to-open-a-file-with-sublime-text-from-your-browser.html allow mapping vm paths to host's paths.

@fabpot
Copy link
Member
8000
fabpot commented Oct 5, 2015

Closing as some solutions have been proposed here. We might want to add a small cookbook entry in the documentation though.

@nicolas-grekas
Copy link
Member

See #19807 for a Symfony-inside solution that is coming to 3.2

fabpot added a commit that referenced this issue Sep 14, 2016
…mapping for IDE links (nicolas-grekas)

This PR was merged into the 3.2-dev branch.

Discussion
----------

[FrameworkBundle] Add %debug.file_link_format% with remapping for IDE links

| Q             | A
| ------------- | ---
| Branch?       | master
| New feature?  | yes
| Tests pass?   | yes
| Fixed tickets | #14340
| License       | MIT
| Doc PR        | symfony/symfony-docs#6944

`templating.helper.code.file_link_format` is a parameter that requires templating to be defined, but holds a concept that is used beyond templating borders.
Let's make it a general parameter that can be injected easily when required.

Commits
-------

1c4ca8c [FrameworkBundle] Add %debug.file_link_format% with remapping for IDE links
@nicolas-grekas
Copy link
Member

ostrolucky pushed a commit to ostrolucky/symfony that referenced this issue Mar 25, 2018
…with remapping for IDE links (nicolas-grekas)

This PR was merged into the 3.2-dev branch.

Discussion
----------

[FrameworkBundle] Add %debug.file_link_format% with remapping for IDE links

| Q             | A
| ------------- | ---
| Branch?       | master
| New feature?  | yes
| Tests pass?   | yes
| Fixed tickets | symfony#14340
| License       | MIT
| Doc PR        | symfony/symfony-docs#6944

`templating.helper.code.file_link_format` is a parameter that requires templating to be defined, but holds a concept that is used beyond templating borders.
Let's make it a general parameter that can be injected easily when required.

Commits
-------

1c4ca8c [FrameworkBundle] Add %debug.file_link_format% with remapping for IDE links
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

8 participants
0