clang格式会自动更改功能块注释,如何禁用它? [英] clang-format automatically changes function block comments, how to disable it?

查看:104
本文介绍了clang格式会自动更改功能块注释,如何禁用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我选择 ColumnLimit 时,任何非零值.它将块注释转换为Doxygen块注释(在新行的 * 之前添加空格).但我不想更改它.如何禁用它?

When I select ColumnLimit any non-zero value. It converts block comments into Doxygen block comments (it adds space before * on a new line). But I do not want to change it. How can I disable it?

.clang格式的文件

My .clang-format file

ColumnLimit: 100
IndentWidth: 4
TabWidth: 4
UseTab: Never

它将转换以下块注释

/*****************************************************************************
*   A brief comments.
*
*   @param theory .
*
******************************************************************************/

进入此

/*****************************************************************************
 *   A brief comments.
 *
 *   @param theory .
 *
 ******************************************************************************/

注意:它在每行之前添加了空格,我不希望这些空格.我不想通过为每个Doxygen注释块禁用clang格式来解决此问题.这似乎很荒谬.

NOTE: It added spaces before each line, I do not want these spaces. And I don't want to solve this by disabling clang-format for every Doxygen comment block. That seems ridiculous.

有什么好的建议吗?:-)

Any good suggestions? :-)

推荐答案

在您的 .clang-format 文件中添加以下行

Add the following line in your .clang-format file

CommentPragmas:  '^[^ ]'

这将强制clang格式不更改代码中的任何注释.

This will force the clang-format not to alter any comments in the code.

这篇关于clang格式会自动更改功能块注释,如何禁用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆