-
Notifications
You must be signed in to change notification settings - Fork 565
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 new align_func_params_star_gap option #3889
base: master
Are you sure you want to change the base?
Conversation
I don't claim to really grok the code, this pull request is a product of "guess and check" :-) so please review carefully! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make sure etc/uigui_uncrustify.ini
is build in release mode? The only changes there should be the new option, without affecting all the others. You can see instead that numbers have been added to each option, which happens in debug mode.
I converted this to DRAFT till we further understand the bug described here. We shall first address that bug, then revisit the need for this additional option. |
Okay, I wasn't entirely sure how to accomplish what you were asking, but I think I figured it out: ╎❯ mkdir release
╎❯ (cd release; cmake -DCMAKE_BUILD_TYPE=Release ..; make)
╎❯ python3 ./scripts/release_tool.py optiondocs release/uncrustify |
(note we should rebase and rework this on top of #3893 before merging) |
The documentation for align_func_params_span, align_func_params_gap, and align_var_def_star_style aren't completely clear. There may be confusion from readers how which parameters are aligned, and when the options actually take effect. This commit tries to flesh out the documentation a little bit more, to hopefully add some clarity.
ea6d95c
to
cedbdb1
Compare
This commit adds a new option, align_func_params_star_gap, that when paired with align_var_dev_star_style = dangle, provides a way to specify a minimum gap that stars won't dangle into. Closes: uncrustify#3770
This commit regenerates the documentation following the addition of the align_func_params_star_gap option.
This commit adds a small test file to show what the align_func_params_star_gap option is supposed to do.
okay, I won't say I'm 100% confident this is right, but it passes the tests, and I think it's in better shape than before. Dropping draft status following discussion from #3770 |
@halfline |
So first let me make sure I'm following you. You wrote:
but if I'm reading you right, I think you actually meant:
right? My big issue with that is it's a pretty big semantic change. Take for instance, someone who wants their function spaced like this:
Right now they'd set a gap of 4 and a star style of dangle. If we make your proposed change, it's going to start looking like this:
Notice, there's more space in the top function now. All of sudden existing code bases will start formatting differently. Furthermore, there will be no way to get the old behavior back for people who really wanted the old behavior. Having said that, having thought about it more, for my use case, I do think what you propose would work okay. So I suppose we could ditch As you said, it does lose flexibility. It means people won't be able to do this from my test case:
(keep the name type and value a minimum number of spaces from each other, while also keeping the type name and stars a different minimum number of spaces from each other) I don't want that in my codebase, so it's not critical for me. I still have a preference for two different options. It seems to provide the most flexibility and the least chance to break existing code bases. amperstand is an interesting question...I don't use C++ so it's not something I put much thought into. I suspect it may be be somewhat broken already since I guess we could add some more test cases to see how it behaves |
Yes, thanks for "reading between the wrong lines" and understand what I meant. You made some very valid points. After thinking quite a bit more about all the discussion, it may be just easier to leave the PR as you created: the users will decide whether to use the new option or not.
|
(just a quick note to say this is still on my radar to come back to soonish, but it's pushed down the stack a little, so it might be a few days) |
No worries, ping me here when you are ready with that |
This commit adds a new option, align_func_params_star_gap, that when paired with align_var_dev_star_style = dangle, provides a way to specify a minimum gap that stars in function parameters won't dangle into.
Closes: #3770