Skip to content
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

Fix objc colons getting incorrectly labels in fallback ternary case #4312

Merged

Conversation

PoeticPete
Copy link
Contributor

(Please review #4311 first. That will eliminate most of the changes in this stacked PR.)

Fixes #4310

The following gets formatted

    [[FOO alloc] target:true ? 1 : 2
                target2:ivar ?: fallback
                target3:ivar ?: fallback
                target4:1];

into

    [[FOO alloc] target:true ? 1 : 2
     target2 : ivar ?: fallback
     target3 : ivar ?: fallback
     target4 : 1];

cfg

sp_cond_colon                   = force
align_oc_msg_colon_span         = 1
indent_columns                  = 4
indent_with_tabs                = 0
indent_ternary_operator         = 2

This PR fixes it by early returning if there is a colon immediately after a question mark

@PoeticPete PoeticPete changed the title Fix objc question color bracket Fix objc colons getting incorrectly labels in fallback ternary case May 28, 2024
@gmaurel gmaurel merged commit 63016a5 into uncrustify:master Jun 4, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad ?: format in objc
2 participants