简体   繁体   中英

clang-format automatically changes function block comments, how to disable it?

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?

My .clang-format file

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

It converts the following block comments

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

into this

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

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? :-)

Add the following line in your .clang-format file

CommentPragmas:  '^[^ ]'

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM