【问题标题】:Clang xcode code formatter puts new lineClang xcode代码格式化程序放置新行
【发布时间】:2014-05-15 18:07:35
【问题描述】:

我为 xcode 安装了 Clang 并用它格式化了我的代码

一切似乎都很好,除非类名对于属性来说太长,它会转到下一行

有什么设置可以防止这种情况发生吗?

@property(nonatomic, strong)                            <==bad (the new line)
UITableViewDelegate *invoiceListTableViewDelegate;
@property(nonatomic, strong) NSDate *lastCall;  <== good 

这是我的属性文件:

---
# BasedOnStyle:  LLVM
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
ColumnLimit:     250
ConstructorInitializerAllOnOneLineOrOnePerLine: false
DerivePointerBinding: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerBindsToType: false
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: false
Standard:        Cpp03
IndentWidth:     2
TabWidth:        8
UseTab:          Never
BreakBeforeBraces: Attach
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles:  false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
...

【问题讨论】:

    标签: xcode clang


    【解决方案1】:

    听起来您想取消选中 Xcode“文本编辑”首选项中的换行复选框:

    【讨论】:

      猜你喜欢
      • 2010-12-03
      • 2010-09-28
      • 2013-09-11
      • 1970-01-01
      • 1970-01-01
      • 2015-01-15
      • 2012-11-23
      • 1970-01-01
      相关资源
      最近更新 更多