c – 具有多行函数声明参数的Clang格式问题

Clang格式一直这样做:
bool importSomethingIn( const boost::property_tree::ptree& inBoostTree,int inSomeIndex,std::shared_ptr<Something>
                            inSomething,int x,int y );

当我想要这样做:

bool importSomethingIn( const boost::property_tree::ptree& inBoostTree,std::shared_ptr<Something> inSomething,int y );

请注意,它是在符号之前添加一个换行符和缩进.它似乎始终是导致此行为的模板类型.

如何阻止这样做?

这是我当前的.clang格式:

BasedOnStyle: LLVM
Language: Cpp
AccessModifierOffset: -4
AlignescapednewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDeFinitionReturnType: true
AlwaysBreakBeforeMultilinestrings: false
AlwaysBreakTemplateDeclarations: false
BinPackParameters: false
BreakBeforeBinaryOperators: false
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120
CommentPragmas: ''
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointeralignment: false
DerivePointerBinding: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
IndentFunctionDeclarationAfterType: true
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 60
Pointeralignment: Left
PointerBindsToType: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: true
Standard: Cpp11
TabWidth: 8
UseTab: Never

编辑:我使用cl格式Xcode插件,我获得了here在github 2016年7月(首先安装了阿尔卡特拉德然后ang格式插件与Aclatraz).我不完全确定clang格式二进制文件的位置,因此没有看到插件附带的版本号.

但是,根据下面的建议,我使用Homebrew安装了clang格式,它给了我3.9.0版本.然后我将Xcode插件设置为“使用系统clang-format”,并得到所需的结果,所以我猜这是一个bug.

解决方法

在ubuntu 16.04上,您的情况似乎很好,cl格式3.8

>安装clang-format-3.8

sudo apt-get install clang-format-3.8

>在〜/ .vimrc

map <F3> :pyf /usr/share/vim/addons/Syntax/clang-format-3.8.py<cr>                  
imap <F3> <C-o>:pyf /usr/share/vim/addons/Syntax/clang-format-3.8.py<cr>

>使用@ OP的.clang格式和源代码

mkdir ~/test
vim ~/test/.clang-format
vim ~/test/test.cpp

>在vim中格式化test.cpp(使用F3),然后结果:

bool importSomethingIn( const boost::property_tree::ptree& inBoostTree,int y );

相关文章

本程序的编译和运行环境如下(如果有运行方面的问题欢迎在评...
水了一学期的院选修,万万没想到期末考试还有比较硬核的编程...
补充一下,先前文章末尾给出的下载链接的完整代码含有部分C&...
思路如标题所说采用模N取余法,难点是这个除法过程如何实现。...
本篇博客有更新!!!更新后效果图如下: 文章末尾的完整代码...
刚开始学习模块化程序设计时,估计大家都被形参和实参搞迷糊...