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 288 forks source link

"One liner" #11

Closed neilyoung closed 10 years ago

neilyoung commented 10 years ago

Hi Travis,

is there any way to configure, that this sequence

[request setValue:_authentication forHTTPHeaderField:@"Authorization"];

appears as shown above after WebKit formatting? I can only achieve this:

[request setValue:_authentication
    forHTTPHeaderField:@"Authorization"];
tonyarnold commented 10 years ago

I'd love to be wrong, but I don't think clang-format supports this at present: http://llvm.org/bugs/show_bug.cgi?id=18543

tonyarnold commented 10 years ago

I've submitted a patch to clang that should (hopefully) fix this: http://llvm.org/bugs/show_bug.cgi?id=18543#c3

kdbdallas commented 10 years ago

I see you then added a comment after your patch saying you "jumped the gun", so does that mean your patch doesn't fix it?

tonyarnold commented 10 years ago

It fixes plain old Objective-C method calls, but falls apart when it encounters blocks as method parameters. It's no worse than before (better, actually), but it's not "fixed". I've never written any C++ before last night, so I'm still wading through how this all works.

clang-format looks to have some pretty rigid edges at the moment, but I assume that's how all formatters work.

fabiopelosin commented 10 years ago

I've submitted a patch to clang that should (hopefully) fix this: http://llvm.org/bugs/show_bug.cgi?id=18543#c3

@tonyarnold :metal:

tonyarnold commented 10 years ago

Don't get too excited — if you read the thread, you'll see I've still got convincing to do. And I do so ever hate writing tests!

tonyarnold commented 10 years ago

OK, as of #35, setting ColumnLimit: 0 in your .clang-format will keep methods from spanning multiple lines.

travisjeffery commented 10 years ago

:+1:

fabiopelosin commented 10 years ago

:metal: