如果clang是rustfmt,那么它将有一个包罗万象的风格配置选项,它引用缩进样式中的基本区别:
Visual (默认为clang-):
ReturnType<std::vector<int>> ClassName::functionName(int a,
bool b,
float c,
double d,
long double complex e);
static const char* names[] = {"a",
"b",
"c"};块(默认为rustfmt):
ReturnType<std::vector<int>> ClassName::functionName(
int a,
bool b,
float c,
double d,
long double complex e);
static const char* names[] = {
"a",
"b",
"c",
};如何将clang格式配置为在所有语法范围中进行块缩进?
或者任何C++格式化程序都支持块缩进吗?
发布于 2020-05-15 21:07:41
发布于 2020-05-15 12:41:19
默认的样式设置是Microsoft (它对齐打开的paren)。使用BasedOnStyle设置为Google以获取块缩进:
BasedOnStyle: Google发布于 2020-05-15 17:04:22
Uncrustify可以做到这一点,至少只要你能为C++提供的每个可想象的语法范围找到相应的选项--我看不出任何整体的选择。
首先:
nl_func_def_start_multi_line = true
nl_func_decl_start_multi_line = true
nl_func_call_start_multi_line = true
nl_after_brace_open=true
nl_type_brace_init_lst_open = true
nl_enum_own_lines = add
nl_constr_init_args = add
pos_constr_colon = lead_break
pos_constr_comma = lead_breakhttps://stackoverflow.com/questions/61818747
复制相似问题