clang-format removes new lines in array definition with designators

前端 未结 2 2050
一个人的身影
一个人的身影 2021-01-22 11:48

I like to define my array values with a designator, when possible:

enum Mode {
    NONE,
    SPLIT_FILES,
    SINGLE_FILE,
    INVALID
};

const std::string Mode         


        
相关标签:
2条回答
  • 2021-01-22 12:14

    Comments on every line also works.

    enum Mode {
      NONE,         // Comments
      SPLIT_FILES,  // On
      SINGLE_FILE,  // Every
      INVALID       // Line
    };
    
    0 讨论(0)
  • 2021-01-22 12:21

    This answer gave me an acceptable work-around:

    Set ColumnLimit to 0. The trade-off is that no line is automatically wrapped, but this is worth it. All programmers at work tend to not write past column 120 anyway.

    0 讨论(0)
提交回复
热议问题