我正在尝试使用 clang-format 清理我的存储库中的代码。我们使用 WebKit 样式作为格式化的基础,但是我们还想确保多行注释的格式正确。
据我了解,可以通过这样定义 .clang-format 文件来覆盖给定样式的格式规则:
BasedOnStyle: WebKit
AlignTrailingComments: true
这种方式 clang-format 应该对齐尾随注释。
给定输入文件:
/**
* This is a multi-line comment
*/
void function() {
/**
* This is comment inside the function
*/
}
我的期望是以下输出
/**
* This is a multi-line comment
*/
void function()
{
/**
* This is comment inside the function
*/
}
但是我得到的是:
/**
* This is a multi-line comment
*/
void function()
{
/**
* This is comment inside the function
*/
}
我尝试将 Webkit 的格式化选项转储到 .clang 格式文件中,并将 AlignTrailingComments 从 false 更改为 true。这也没有什么区别。
Webkit 样式中是否存在干扰 AlignTrailingComments 选项的选项?