Clang format removes all spaces in my empty lines

I am running the file _clang-formatusing BBUncrustifyPluginfor Xcode.

In Xcode, whenever I make a new line, it saves indent spaces. (Spaces shown as :) Also:

if(YES) { 
••••NSInteger myNum = 2;
••••
••••myNum = 4;
}

When I run my file _clang-format, it removes spaces from my code, so now it looks like this:

if(YES) { 
••••NSInteger myNum = 2;

••••myNum = 4;
}

It doesn't matter, but it leads to annoying commit changes when each new line removes spaces. Not to mention, if I go back to edit the file, I would prefer that these spaces are already there.

I cannot find a key _clang-formatthat can help me fix this. Any help?

Here is my current _clang-formatfile

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.

+6
2

, , - . , clang-format option. Xcode . ( Xcode, , Mac, .)

+3

clang, . Xcode , Preferences > Text Editing:

While Editing:   ☑ Automatically trim trailing spaces  
                   ☑ Including whitespace-only lines
0

Source: https://habr.com/ru/post/1607734/


All Articles