Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundled clang-format issue with long Objecttive-C lines #81

Open
kwasimensah opened this issue Apr 14, 2015 · 10 comments
Open

Bundled clang-format issue with long Objecttive-C lines #81

kwasimensah opened this issue Apr 14, 2015 · 10 comments
Labels

Comments

@kwasimensah
Copy link

I'm using a custom clang_format equivalent to -style="{BasedOnStyle: google, ContinuationIndentWidth: 4, ColumnLimit: 100, DerivePointerAlignment: false, PointerAlignment: Right, UseTab: Never}"

Using ClangFormat-Xcode with the bundled clang-format turns

-(BOOL)reallyLongFunctionName012345678901234567890123456789012345678:(ReallyLongTypeName012345678901234 *)vc{return NO;}

into

- (BOOL)reallyLongFunctionName012345678901234567890123456789012345678:
        (ReallyLongTypeName012345678901234 *)vc{
    return NO;
}

(there's an 4 extra spaces in front of (ReallyLongTypeName012345678901234 *)) Using the system version of clang-format (version 3.7.0) installed from homebrew does the right spacing:

echo "-(BOOL)reallyLongFunctionName012345678901234567890123456789012345678:(ReallyLongTypeName012345678901234 *)vc{return NO;}" | clang-format -style="{BasedOnStyle: google, ContinuationIndentWidth: 4, ColumnLimit: 100, DerivePointerAlignment: false, PointerAlignment: Right, UseTab: Never}"

returns

- (BOOL)reallyLongFunctionName012345678901234567890123456789012345678:
    (ReallyLongTypeName012345678901234 *)vc {
  return NO;
}
@tonyarnold tonyarnold added the bug label May 15, 2015
@jshier
Copy link

jshier commented May 15, 2015

I'm seeing this too, see my Stack Overflow question here: http://stackoverflow.com/questions/30110479/clang-format-stop-breaking-long-methods-up
Solution may be to revert the version of clang format included until this bug is fixed.

@tonyarnold
Copy link
Collaborator

I'll see if I can track down what's happening before reverting. It looks like someone has changed some pretty fundamental stuff with Objective-C formatting without testing properly.

@tobihagemann
Copy link

I'm not sure if this is related to OP's issue, but I'm having the same issue as @jshier. Setting ColumnLimit to 0 was fine a while ago (not sure if it was really introduced with clang-format 3.7), but now this setting behaves differently. I don't want my methods with multiple parameters to break into multiple lines (that line up with the colons.

What I actually don't understand (maybe this has to do something with Alcatraz?): I'm unable to revert to an older version so I'm stuck with this error for now. I'm replacing the folder at ~/Library/Application Support/Alcatraz/Plug-ins/ClangFormat. Isn't that sufficient? Is that the wrong location?

@tonyarnold
Copy link
Collaborator

@MuscleRumble I believe Alcatraz silently upgrades your plugins when you open Xcode.

You should try putting the older version of the clang-format binary in your path, and telling ClangFormat-Xcode to use the system bundled version of clang-format.

@tobihagemann
Copy link

Alriiight! Thanks! That works! :)

@shams-ahmed
Copy link

any update on this issue?

@iSevenDays
Copy link

any update?

@jcislinsky
Copy link

+1

@mmcdole
Copy link

mmcdole commented Jan 8, 2016

Any word on this? Does a bug need to be filed upstream?

@tonyarnold
Copy link
Collaborator

Yeah, if you're game to compile from source the TOT Clang 3.8.0 version of clang-format seems better. ColumnLimit: 0 is broken as hell, but setting it to a really high number works well (it didn't before).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants