Clang-format Overriding multiline comments for WebKit style

I am trying to use clang-format to clear code in my repository. We use the WebKit style as the basis for formatting, but we also want to make sure that multi-line comments are formatted correctly.

In my opinion, you can override the formatting rules of a given style by defining the .clang-format file as such:

BasedOnStyle: WebKit
AlignTrailingComments: true

Thus, clang-format should align the final comments.

Given the input file:

    /**
     * This is a multi-line comment
     */
    void function() {
        /**
         * This is comment inside the function
         */
    }

My expectation is the next conclusion

/**
 * This is a multi-line comment
 */
void function()
{
    /**
     * This is comment inside the function
     */
}

However, I get:

/**
     * This is a multi-line comment
     */
void function()
{
    /**
         * This is comment inside the function
         */
}

I tried to reset Webkit formatting options to a .clang format file and change AlignTrailingComments from false to true. It does not and is no different.

Is there any Webkit-style option that interferes with the AlignTrailingComments options?

+4
3

AlignTrailingComments , :

int short;        // short
int longlonglong; // long
+2

: CommentPragmas , .

0

Add the following line to your configuration:

ColumnLimit: 9999
0
source

All Articles