Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 768
Umair Avatar asked Nov 16 '22 15:11

Umair


1 Answers

Add the following line in your .clang-format file

CommentPragmas:  '^[^ ]'

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

like image 164
Umair Avatar answered Dec 28 '22 11:12

Umair