How can I align function parameter names in clang-format?

后端 未结 3 2054
渐次进展
渐次进展 2021-01-13 20:36

Is it possible to use clang-format to format struct members and function parameter names into columns?

For example:

struct
{
   int                


        
3条回答
  •  猫巷女王i
    2021-01-13 20:48

    clang-format recently (3.7 or 3.8) gained some more options to adjust alignment, what I was asking in my question is still not fully supported, but we can now get a little closer:

    AlignConsecutiveDeclarations: true
    

    which aligns declarations like shown above.

    Unfortunately there still seems to be limited control for formatting of the pointer asterisk, see clang-format: Align asterisk (*) of pointer declaration with variable name

提交回复
热议问题