2
votes

I'm having trouble getting my clang-format to quite cooperate with multi-line comments. I have tried:

CodePragmas: '^[^ ]'

But this still results in the following. Before formatting:

class Test
{  
/* =======
 * Public Functions
 * ======== */
public:
};

After formatting:

class Test
{  
  /* =======
 * Public Functions
 * ======== */
public:
};

Any help would be greatly appreciated. Thanks.

1

1 Answers

0
votes

I have a slightly different comment format, but same situation. If you know the format of your block comments all use the same pattern, I think something like this will work:

CommentPragmas:  '/\* =======\n((.+\n.+)+)======== \*/'

If you want to exclude all multi-line block comments, I think this will work:

CommentPragmas:  '/\*(.+\n.+)+\*/'

I found that the ColumnLimit still applies to those comments, causing them to wrap in undesirable ways. Otherwise, clang-format (3.8) leaves those blocks untouched.