travisjeffery / ClangFormat-Xcode

Xcode plug-in to to use clang-format from in Xcode and consistently format your code with Clang
https://twitter.com/travisjeffery
MIT License
2.89k stars 287 forks source link

Comment and NSString wraps on format #97

Open memreas opened 9 years ago

memreas commented 9 years ago

Hi, This software is great but since XCode 6.4 came out I've seen this issue come up where when I save comments are wrapped after each word and the same goes for NSStings. Here are examples:

NSString:

                                                             if (error == nil) {
                                                               NSLog(@"image "
                                                                     @"stored "
                                                                     @"as "
                                                                     @"alasset"
                                                                     @" %@",
                                                                     assetURL);
                                                             } else {
                                                               NSLog(@"error "
                                                                     @"stori"
                                                                     @"ng "
                                                                     @"image"
                                                                     @" as "
                                                                     @"alass"
                                                                     @"et");
                                                             }

Comment:

                                                             // end
                                                             // ALAssetsLibrary
                                                             // completion
                                                             // block

I've tried to add this to my projects .clang-format file:

BasedOnStyle: LLVM
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
ColumnLimit: 0

I've also tried just ColumnLimit:0 as the only line in the file but that didn't seem to work. This happens mostly when I have embedded completion blocks which push out the code to the column limit but trying to set the column limit didn't seem to fix it.

I could be wrong it may be just configuration?

Thanks, John