-
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
Add minimum attributes option for attribute wrap #1818
Conversation
@ang-zeyu |
d300190
to
a7030f3
Compare
Done, thanks! What do you think of the scope of the usage? Should it affect |
@ang-zeyu |
Hi @bitwiseman, noted, no worries! We aren't under any schedule here 🙂 |
Can this be made to work with CSS as well? Would love to set this to -1 or an arbitrarily high number so I can get all CSS property rules on a single line |
@probablyup |
4746042
to
9d4e092
Compare
9d4e092
to
6edbfb5
Compare
I've changed the behaviour here a little since last (d8bcf29) for the <input type="text" />
// now possible
<input
type="text"
/> backward compatibility is still kept since the default |
I would love to see this feature in js-beautify as well as VS Code HTML formatter. |
Yes, same here. I'm using https://github.com/shufo/blade-formatter and that repo also has multiple open issues for this same feature. Would be really awesome to have this. |
Would love this! |
Description
master
)Fixes Issue: #1758
Usage:
Added a
wrap_attributes_min_attrs
/-M
option (default2
).It only affects
force/force-aligned/force-expand-multiline
currently.Does it make sense for the other non
preserve
options to be affected as well?if preferred, I could take a shot at #1404 before this. But since this is an extension to the spec proposed there, it should work out even if it's dealt with later
Implementation:
I simply moved the lookahead for
force-expand-multiline
tohandle_tag_open
, and changed the relevant parts accordingly. This might affect performance a little forforce/force-aligned
options.Alternatively, it could be done at the tokenizer level with an even smaller performance hit (since the
read_attribute
handler has easy access toopen_token
). I'm not sure if there's something against extendingtoken
for separate beautifiers thoughBefore Merge Checklist
These items can be completed after PR is created.
(Check any items that are not applicable (NA) for this PR)