-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Include Syntax Highlighting Language Option in Var-Dumper Dumps #164
Labels
Milestone
Comments
This was referenced Apr 30, 2024
Using trap the user may provide any custom context for dump's Data object. trap($phpCode)->context(language: 'php'); Note: the feature wasn't released yet. It's in master branch now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
We aim to enhance Var-Dumper by allowing developers to specify the language for syntax highlighting within their dumps. This enhancement will streamline the debugging process and improve the readability of dumped content, particularly in cases involving multiple programming languages.
Introduce a new parameter or method within Var-Dumper that enables developers to specify the language for syntax highlighting. This parameter could accept standard language identifiers or aliases, such as those commonly used in code editors or highlighting libraries (e.g., "php", "javascript", "python", etc.).
The current method for adding additional context to a VarDumper involves complex and verbose code, which can be cumbersome and error-prone. This proposal aims to enhance the Symfony VarDumper API to provide a more intuitive and concise way of adding context information.
Proposed Solutions:
VarDumper
class, such asaddContext()
, which accepts an array of default context settings. Developers can then call this method to set default context options, including the language for syntax highlighting. See https://github.com/symfony/var-dumper/blob/7.0/VarDumper.php#L101dump()
function: Extend thedump()
function to accept a named argumentcontext
, allowing developers to specify default context settings directly when callingdump()
.UPD: as I can see there is a PR in symfony repository symfony/symfony#48667 that can solve our problem.
The text was updated successfully, but these errors were encountered: