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

中文字符串显示不正确 #119

Open zb737472783 opened 8 years ago

zb737472783 commented 8 years ago

bug 这是一整个字符串,却格式化成多个.

yixiang commented 8 years ago

Just verified the behavior. However, this is a problem of the clang-format command, not a problem with the XCode-Clang-Format plugin. Please file a bug with clang-format. Find info here http://clang.llvm.org/OpenProjects.html

As a work around, you can just manually separate the string as below, the plugin won't mess up the formatting in that case. Please

@"山东省龙口市的肌肤上看见的疯狂世界东方时"
@"的疯狂送点福利时间到付款送来的风";

刚刚确证了你描述的行为。只不过这是一个clang-format命令的问题,不是这个插件的问题。插件只是通过调用clang-format命令来实现格式化。请报bug给clang-format。详情请见:

作为一个临时解决方案,你可以手动将字符串分段如下。

@"山东省龙口市的肌肤上看见的疯狂世界东方时"
@"的疯狂送点福利时间到付款送来的风";

请关闭这个问题。

zb737472783 commented 8 years ago

是需要调整那个参数,能说一下吗?

zb737472783 commented 8 years ago

BasedOnStyle: LLVM BreakBeforeBraces: Linux ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: true ObjCBlockIndentWidth: 4 TabWidth: 4 UseTab: Always Language: Cpp IndentWidth: 4 AlignTrailingComments: true SpacesInParentheses: true SpacesInContainerLiterals: true SpacesInAngles: true SpacesBeforeTrailingComments: 1 SpaceInEmptyParentheses: true PenaltyExcessCharacter: 1 MaxEmptyLinesToKeep: 1 IndentCaseLabels: true CommentPragmas: '' SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements AccessModifierOffset: 0 AlignEscapedNewlinesLeft: true AllowAllParametersOfDeclarationOnNextLine: false AllowShortFunctionsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: false BinPackParameters: false BreakBeforeBinaryOperators: false BreakBeforeTernaryOperators: false BreakConstructorInitializersBeforeComma: false ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 0 ContinuationIndentWidth: 0 Cpp11BracedListStyle: false DerivePointerBinding: false IndentFunctionDeclarationAfterType: false NamespaceIndentation: All PenaltyBreakBeforeFirstCallParameter: 100 PenaltyBreakComment: 100 PenaltyBreakFirstLessLess: 0 PenaltyBreakString: 100 PenaltyReturnTypeOnItsOwnLine: 20 SpacesInCStyleCastParentheses: true SpacesInContainerLiterals: true

yixiang commented 8 years ago

不是调参数。是手动格式化成这样:

self.reserveOrderAddress =
    @"山东省龙口市的肌肤上看见的疯狂世界东方时"
    @"的疯狂送点福利时间到付款送来的风";

这样你下次自动格式化文件时候你的格式就不会被错误格式化了。