-
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 'aligned' option that align attributes after specific line length… #1297
Conversation
Thanks the PR. You understood exactly how the test matrices work. In #1262, they ask for: <div v-for="item in items"
class="items"
v-if="items.notEmpty()"
:class="{active: isActive}
:key="item.id">
<p>{{item.name}}</p>
</div> Whereas this PR would allow for something like (depending on the wrap line length): <div v-for="item in items" class="items" v-if="items.notEmpty()"
:class="{active: isActive} :key="item.id">
<p>{{item.name}}</p>
</div> To do #1262, you'll need to look-ahead to see if the current element with attributes is going to wrap and then switch to force-align mode if that is the case. In terms of quality, this is a fine PR, it just needs to be changed to implement the feature described in #1262. |
Hmm, good point, I think it can be discussed. I was in first place solving my own problem and the issue in #1285, and didn't quite address what was requested in #1262. Frankly speaking, what I was trying to recreate was Intellij's behavior: it doesn't wrap attributes before certain length but wraps and aligns them every time the line is over a threshold. If there is room for more than one attribute, so it tries to fit them, otherwise wraps. Our code style (grown from the time when the majority of devs on the project were using IntelliJ) doesn't impose that every attribute is on the new line (in this case we could just use force-align). (And personally, I think it's a bit strange behavior - like, we are fine with 3-5 attributes until line is below threshold, but suddenly if the threshold is reached, so it's one per line). I thought that all JetBrains' products behave like this, but I maybe not, and I totally understand that people may want such behavior :) I am not familiar how code formatting is configured in these IDEs and why it is different, though. Furthermore, what was requested in #1285, demonstrates kinda the opposite behaviour - it removes existing line breaks and reindents everything according to line length and indents. I am not sure how this should work with preserve-newlines? Not sure either that my implementation will handle this correctly. So in order to make more people happy (at least me, author of 1262 and 1285), we should maybe provide some combination of options that enables all the scenarios? Like, 'soft' indented wrapping, and force wrapping but after certain initial line length. Any architectural tips on that? |
@cheerypick |
@cheerypick Any chance to look at this further? |
Oh, @bitwiseman, sure. Had to prioritize other things, but will look at it hopefully this week. |
@cheerypick Bump. I understand if you're busy, just checking. |
Not really sure what is holding this up, but I might fork this and try to get it merged and closed, as I would love to see this feature in the next release. |
@RenaldasK @cheerypick said:
I said I was fine if we wanted to have two separate PRs - this one to address #1285, another to address #1262. If we go that route I'd still like to have the naming figured out - If #1285 behavior is @cheerypick also, mentioned a number of other scenarios that might or might not have side-effects in this area. I wasn't sure how to proceed. Separately, looking at the complexity of this area, there probably needs to be another test or two, or even another matrix entry - maybe a Once again, this is solid PR as it stands, I was mostly waiting on @cheerypick to make the call about what direction she wanted to go - Adding #1262 or just doing #1285. |
For the naming, here's what I propose: #1285 is "soft" because it doesn't align every single attribute, just the lines themselves. This would be really helpful for my team so I really hope we can at least get #1285 merged if that's already done, then we can work on #1262. |
Hey @bitwiseman, @cheerypick, @michaelauderer, other folks that are interested. Here's my take on the topic. What we have
I think that there are multiple (orthogonal) concerns here and putting them all into single value would create more confusion and weird option names explosion if we are to handle all cases. So, let's separate wrapping, aligning and number of attributes per line, etc. Proposal
When the wrapping is in action, the following properties are in play. If no wrapping happens, they don't play any role.
Examples
|
@vvs Could you open a new issue and put your whole comment in there? @michaelauderer Oh, one other thing we need in order to accept this change - update the README.md with the new option. Thanks everyone! |
@michaelauderer |
… if wrap line length is set
@bitwiseman Unfortunately I don't, but it looks like you have it working now! I see that this is part of v1.7.6 milestone, but there are a few other issues blocking that release. However, since this has been a highly requested feature for a long time (we really need this fix pulled into VSCode), would it be possible to release this now and move the remaining 4 issues to v1.7.7? |
This PR is about requested soft-alignment feature of attributes alignment after and only after specific line length threshold is reached.
related to #1262
Basically, this PR adds a new option that doesn't match 'is_wrap_attributes_force' condition (that forces line break after each attribute) but indents the attributes same way as 'is_wrap_attributes_force_aligned' if 'wrapped' is set to true by wrap_line_length.
//At least, I suppose it does :)
As I said previously, I am not exactly an open source expert, so comments, guidance, and advice appreciated.
(Hope that I understood how the test matrices work correctly too)