Code Style Formatting For Loop plus... Follow
Answered
Hello,
I just purchased AppCode. Very impressed with what I see so far.
I have two questions.
1) When I choose Code -> Reformat Code, my "for" loop is formatted in a very odd way.
for ( var i = 0; i < 10; i += 1 )
is reformatted to:
for ( var i = 0;
i < 10;
i += 1 )
How can I change this so it doesn't format it this way? I don't see an option in Preferences...-> Editor -> Code Style -> Swift -> Wrapping and Braces.
2) Is there a way to have AppCode apply formatting as I'm working (like ReSharper does) so I don't have to go to Code -> Reformat Code every time I want my code formatted?
Thanks,
Mark
Please sign in to leave a comment.
Hi Mark.
Which Swift version are you using in the project? I believe we no longer support Swift 2.x syntax (i.e. C-style loop that you've mentioned) in latest AppCode versions. Which AppCode version are you on, BTW? And which Xcode is selected in Preferences | Tools | Xcode?
As for the second question, formatting should normally work as-you-type, there's no specific setting for that. If you noticed specific cases where it fails to work so, please share with us (either here or directly in tracker).
Hi Tatiana,
Swift version: 4
AppCode version: 2017.3
Selected Xcode version in AppCode: 9.2
For my first question, I'm a knucklehead. I was writing C# in my Swift code. Sorry. :-/
However, for my second question, here's the pattern. And, this isn't just applicable to 'for' loops - I did this when creating a 'func' as well.
I would expect it to format like this (placing the left brace on a new line directly beneath func):
Same happens to the 'for' and probably the others too.
My "Editor -> Code Style -> Swift -> Wrapping and Braces -> Braces placement" settings are:
In type declarations Next line, each shifted
In methods and functions Next line, each shifted
Other Next line, each shifted
Thanks,
Mark
Hi Mark,
Thanks for the additional info - I've created OC-16785 per your report. Please vote for it.