-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Preserve line breaks in scoped code #1083
Comments
I agree it would be best to preserve formatting if possible. I tried it at some point but had to give up as it requires more work, as PHP-Scoper modifies/inserts some statements. There was an attempt done at #1051. I think nikic/PHP-Parser#1007 (comment) opened as part of that PR nikic/PHP-Parser#1007 (comment) |
If you ever solve this it would be amazing! I'm sure though you have enough on your plate 🥤 |
Seems like others are struggling with the same problems.
|
The problem is not so much the nature of AST: AST works fine because the formatting information is preserved as part of the nodes data. What is less clear and harder is knowing how to modify that formatting when inserting or removing nodes or alternatively how to handle incoherent token positions within the printer. There is a native printer that somewhat handles this, but it's not clear to me if I'm missing something within PHP-Scoper or if there is more to address in the PHP-Parser printer |
Feature Request
Currently, quite some line breaks are being stripped from scoped code. This makes that code hard to read (I'm also scoping my own package's main code).
If it's technically possible, it would be amazing to preserve all line breaks / leave them untouched.
The text was updated successfully, but these errors were encountered: