Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clang-format seems to ignore CommentPragmas

Tags:

clang-format

I have the following CommentPragmas setting:

CommentPragmas: 'MARKER'

And I expect this to make clang-format (version 8.0.0) ignore the comments in this piece of code:

    enum bar {
    // MARKER: foo
        hello = 1
    // MARKER: foo
    };

However, clang-format indents these comments (aligning them with hello = 1). Am I doing something wrong?

like image 391
mnieber Avatar asked Nov 07 '22 03:11

mnieber


1 Answers

You're not doing anything wrong, this is just what clang-format does. CommentPragmas prevents breaking comments into multiple lines, but does not prevent indenting them.

I had thought this was documented, but now I see that it isn't. :(

like image 97
Eric Backus Avatar answered Nov 27 '22 19:11

Eric Backus