-
Notifications
You must be signed in to change notification settings - Fork 105
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
Support for additional formatting options for inner parg groups #174
Comments
Dealing with this specific formatting has actually been quite challenging. The problem is that it's really hard to come up with appropriate rules using only the position in the argument tree. In particular, are you aware of the fact that there are some build in cmake commands that have as many as three levels if inner argument groups? There are a couple of features in work that should help you get what you want:
whereas a small list of long arguments might look better wrapped:
and furthermore, perhaps we wouldn't wrap a list if it were on it's own:
but if it's next to another keyword which is wrapped, then maybe we prefer to so as well:
I would really like to be able to describe these conditions with a cost function that has user-configurable weights. I tried once before but couldn't come up with something I was happy with, so that is still on the queue. In any case, I do intend to try to deal with this issue soon, but I think it's quite a bit harder than your proposed |
Nope 😁
Options 2 and especially 3 sound like a good solution, at least from a users PoV. |
@cheshirekow Is there any update on the support of "per-command overrides" for config options like "max_pargs_hwrap"? Thanks! |
I think this is part of the problem I have setting up cmake-format to match my own (idiosyncratic, no doubt!) idea of what's right. Firstly I always want file and path lists to use vertical wrapping (e.g. in I then also need to be able to provide cmake-format with the context that a particular list in a E.g. set(NOTFILES meow purr hiss)
set(FILESLIST1 # cmf: file-list
meow.h
purr.h
hiss.h
)
set(FILESLIST2 # cmf: file-list
yowl.h
) |
We've started to use
cmake-format
recently and so far are quite happy with the formatting results 👍 One case where readability - at least in our opinion - has decreased however, is the formatting of "inner parg groups" likeSOURCES
andLIBRARIES
in places like the following snippet:The expectation would be to get something like
We can decrease
max_pargs_hwrap
to achieve this, but any value below 3 results in really weird formatting - even a simpleif(${A} STREQUAL B)
is broken onto two lines then. Thus I'd be great to have a separate, optional config optionmax_inner_pargs_hwrap
that is taken into account when aparg
group is nested (i.e. it has a parentkwarg
). I'd be happy to support with testing.The text was updated successfully, but these errors were encountered: