-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
HTML: wrap_line_length is handled incorrectly #1401
Comments
This is a smallest test case I could come up with, but I am seeing this problem A LOT, inside VS Code, when reformatting some long lines. The setting is set to 80, but I am seeing lines up to 150 characters! When I set it to 40, I see lines up to 100, etc. My expectations are that if the max line length limit is set to some value, then js-beautify should try to honor that value and only produce longer lines only if there is no other way. |
@vvs The beautifier doesn't have sufficient information to do line wrapping correctly in all cases, but this is definitely a bug. |
I think 35dc66a may address this issue, but I haven't written tests to check. Thanks for the good examples above, they will make good tests. |
This is improved (see #1432) but still not really right. |
I ran this on v1.8.0-rc4, with the following settings:
And the actual output was this:
It hasn't resolved the issue, but the line wraps after '14' instead of '16' so there seems to have been a shift closer to correct. |
Description
js-beautify doesn't handle
wrap_line_length
properly. Say, I have set it to 40. But the beautifier breaks the line not on 40th character. In my case it is on 50th character. In fact, the text content of the span tag is broken exactly on 40th character, but the setting should be related to the whole line, not to the length of the content inside the tag.Input
The code looked like this before beautification:
Expected Output
The code should have looked like this after beautification:
Actual Output
The code actually looked like this after beautification:
Environment
OS: Windows 10
Settings
Example:
The text was updated successfully, but these errors were encountered: