我的函数调用如下所示(没有明显的原因):
func
(
a,
b,
c
)
有没有办法让 uncrustify 将函数折叠成一行?我已经尝试了两天了,没有断断续续的...
我让它适用于函数声明,但我没有让它适用于函数调用。
当我们这样做时,我也有如下所示的函数:
func
(
a, // (IN) the A
b, // (IN) something b
c // (OUT) the resulting value
)
有没有办法在不破坏代码的情况下处理这种情况?由于 uncrustify 保留评论,我认为这是不可能的。对于函数声明,它将其折叠到第一个注释。
阅读文档,我想出了这个:
# Add or remove newline between a function name and the opening '('
nl_func_paren = remove # ignore/add/remove/force
# Add or remove newline between a function name and the opening '(' in the definition
nl_func_def_paren = remove # ignore/add/remove/force
# Add or remove newline after '(' in a function declaration
nl_func_decl_start = remove # ignore/add/remove/force
# Add or remove newline after '(' in a function definition
nl_func_def_start = remove # ignore/add/remove/force
# Add or remove newline after each ',' in a function declaration
nl_func_decl_args = remove # ignore/add/remove/force
# Add or remove newline after each ',' in a function definition
nl_func_def_args = remove # ignore/add/remove/force
# Add or remove newline before the ')' in a function declaration
nl_func_decl_end = remove # ignore/add/remove/force
# Add or remove newline before the ')' in a function definition
nl_func_def_end = remove # ignore/add/remove/force
不过,正如你所预料的那样,评论有点毁了它。那里is更改的选项单行注释 (//
) into 阻止评论 (/* ... */
)但是,这应该使您可以更轻松地手动连接行(例如在 vim 中v%J
)
# Whether to change cpp-comments into c-comments
cmt_cpp_to_c = true # false/true
我用原型、声明对其进行了测试and calls:
- input http://ideone.com/VPOTF http://ideone.com/VPOTF
- output http://ideone.com/z6jYY http://ideone.com/z6jYY
通话不受影响。另请注意以下相关选项:
# Whether to fully split long function protos/calls at commas
ls_func_split_full = false # false/true
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)