8000 [Var-Dumper] Automatically add an hyperlink to the file in CliDumper · Issue #30830 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Var-Dumper] Automatically add an hyperlink to the file in CliDumper #30830

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
ktherage opened this issue Apr 2, 2019 · 9 comments
Closed

[Var-Dumper] Automatically add an hyperlink to the file in CliDumper #30830

ktherage opened this issue Apr 2, 2019 · 9 comments

Comments

@ktherage
Copy link
Contributor
ktherage commented Apr 2, 2019

Description
During few days, i had to use the dump() function in order to debug failing unit test.
In order to see where i placed dumps (and don't forget to remove them after the fix) i used to add the following argument to my dumps dump(__FILE__.' l.'.__LINE__, $myVar).

** Possible solution **
I made a POC which uses the debug_backtrace to get file and line and add those attributes to style which has effect to add a href in the console to the file. Ideally the final version would add a line like using dump(__FILE__.' l.'.__LINE__, $myVar) with this href.

Example
master...ktherage:poc-var-dump

Gif preview of the POC
poc-var-dump

WDYT ?

@ktherage ktherage changed the title [Var-Dumper] Automatically add file and lin number in CliDumper [Var-Dumper] Automatically add file and line number in CliDumper Apr 2, 2019
@ktherage ktherage changed the title [Var-Dumper] Automatically add file and line number in CliDumper [Var-Dumper] Automatically prepend file and line number in CliDumper Apr 2, 2019
@ro0NL
Copy link
Contributor
ro0NL commented Apr 2, 2019

ref #28395

now that files can be linked, the visual output will be shorter. And actually the same feature is available in web already.

i agree having a file/line reference in CLI is handy. I've been searching my dumps() before 😅

@ktherage
Copy link
Contributor Author
ktherage commented Apr 2, 2019

@ro0NL i didn't see why this PR had been closed.

@curry684
Copy link
Contributor
curry684 commented Apr 6, 2019

It was closed because it would also cause a lot of extra output in situations where it was needed at all, as such having a detrimental effect on the debugging experience (more scrolling, less overview).

I'd be open for another attempt, but it would need to have some way of determining when useful or not.

@ktherage
Copy link
Contributor Author
ktherage commented Apr 6, 2019

@curry684, well so what about adding a function to get a list of placed dumps. 🤔

@curry684
Copy link
Contributor
curry684 commented Apr 6, 2019

Make a reasonable proposal and it will be considered 👍

@nicolas-grekas
Copy link
Member
nicolas-grekas commented Apr 7, 2019

adding a clickable caret ^ like done now next to class names, but at the beginning of dumps?
we should bench if computing the caller file/line would be fast enough also.

@ktherage
Copy link
Contributor Author

@nicolas-grekas you mean adding a caret which drops down the flle path and line in the terminal ?
Or just like i did in the Gif file but adding the kind of tooltip with the flle path and line on a caret?

@ktherage
Copy link
Contributor Author
ktherage commented May 9, 2019

@nicolas-grekas is that what you were expected ?
@curry684 Is that a reasonable proposal ?

Peek 09-05-2019 17-15

I've also open a PR to get more feedback : #31446

@curry684
Copy link
Contributor

That seems pretty awesome actually, wasn't even aware this would be possible :)

@ktherage ktherage changed the title [Var-Dumper] Automatically prepend file and line number in CliDumper [Var-Dumper] Automatically add an hyperlink to the file in CliDumper May 14, 2019
nicolas-grekas added a commit that referenced this issue Sep 28, 2019
…herage)

This PR was merged into the 4.4 branch.

Discussion
----------

[VarDumper] Output the location of calls to dump()

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | not tested yet
| Fixed tickets | #30830
| License       | MIT
| Doc PR        |

see #30830

Commits
-------

f0a59d3 [VarDumper] Output the location of calls to dump()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0