I'm running _clang-format
file using the BBUncrustifyPlugin
for Xcode.
In Xcode, whenever I make a newline, it preserves the indentation spaces. (Spaces shown as •) Like so:
if(YES) {
••••NSInteger myNum = 2;
••••
••••myNum = 4;
}
When I run my _clang-format
file it removes the spaces from my code so now it looks like this:
if(YES) {
••••NSInteger myNum = 2;
••••myNum = 4;
}
Not a huge deal, but it does make for annoying commit changes where every newline removes spaces. Not to mention if I go back to edit the file, I would prefer those spaces to already be there.
I can't seem to find a _clang-format
key that can help me fix this. Any help?
Here's my current _clang-format
file
BasedOnStyle: Chromium,
AlignTrailingComments: true,
BreakBeforeBraces: Linux,
ColumnLimit: 140,
IndentWidth: 4,
KeepEmptyLinesAtTheStartOfBlocks: false,
ObjCBlockIndentWidth: 4,
ObjCSpaceAfterProperty: true,
ObjCSpaceBeforeProtocolList: true,
PointerBindsToType: false,
SpacesBeforeTrailingComments: 1,
TabWidth: 8,
MaxEmptyLinesToKeep: 2,
UseTab: Never,
Thanks.
What you're looking for is an option to disable the removal of trailing spaces. However, clang-format does not appear to have that option. You can, however, set an option in Xcode to automatically remove trailing whitespace. (It's in the Xcode preferences; unfortunately, I'm not on a Mac right now, so I can't get a screenshot for you.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With