How do I force clang-format not to remove the trailing newline for a function call?

I am currently using the version of this config that comes closest to Obj-C idiomatic formatting. However, this violates the following convention, which is annoying enough that I can't automatically include clang-format

:

@import AppKit;

int main() {
    // How can I get clang-format to respect this style?
    CGRect rect = CGRectMake(
        0.f,
        0.f,
        100.f,
        200.f
    );

    NSLog(@"%@", NSStringFromRect(NSRectFromCGRect(rect)));
}

      

Translated into:

@import AppKit;

int main() {
    // Right now it formatted like this, which I do not want.
    CGRect rect = CGRectMake(
        0.f,
        0.f,
        100.f,
        200.f);

    NSLog(@"%@", NSStringFromRect(NSRectFromCGRect(rect)));
}

      

Can you fix this?

+3


source to share





All Articles