Indentation Continuation in Xcode

Is it possible to get Xcode automatic indentation to indentation continuation lines?

I want to:

BOOL someLongVariableName = someLongValue
    | someOtherLongValue
    | moreLongValues

BOOL someOtherLongVariableName =
    someEvenLongerValue;

[someLongVariableName
    performSomeAction:someLongArgument]

I am currently getting:

BOOL someLongVariableName = someLongValue
| someOtherLongValue
| moreLongValues

BOOL someOtherLongVariableName =
someEvenLongerValue;

[someLongVariableName
 performSomeAction:someLongArgument]

To be clear:

  • I use explicit line breaks, not automatic wrapping.
  • I want the correct indentation during editing and immediately after pressing return, and not after starting an external program (for example, uncrustify).
+5
source share
2 answers

I ended up integrating uncrustify to partially get what I wanted. (Case 3 is still off.)

Xcode Integration

In order to get the Xcode code to automatically generate the code, I created the "Aggregate" target with the "Run Script" phase:

find . -name '*.[mh]' -print0 \
    | xargs -0 git diff-index HEAD -- | grep -v "D\t" | cut -c100- \
    | xargs uncrustify -l OC --replace --no-backup -c uncrustify.cfg

uncrustify , git. , , . (, uncrustify .) , , . Xcode .

my uncrustify.cfg indent_continue = 4.

, Xcode . script git pre-commit hook, .

, Objective-C uncrustify , , , . ( clang-format -?)

+1

xcode-preferences-text editing-indentation: , "".

-1

All Articles