【问题标题】:Clang formatting rule to add an empty line before the closing brace of a struct or class?Clang 格式化规则在结构或类的右大括号之前添加一个空行?
【发布时间】:2022-10-19 22:54:39
【问题描述】:

我找不到在类或结构声明末尾添加空行的记录方法。有没有办法让 clang-format 转换这个:

struct foo {
  int bar = 0;
};

对此

struct foo {
  int bar = 0;

};

并且可以选择在开头添加一行也很好:

struct foo {

  int bar = 0;

};

【问题讨论】:

    标签: clang-format


    【解决方案1】:

    我最近发现了同样的问题。要在类声明和内容之间添加新行,请将KeepEmptyLinesAtTheStartOfBlocks 设置为Yes

    但是,似乎没有选项可以在最后一个声明或定义与右大括号之间强制使用空行。

    【讨论】:

      猜你喜欢
      • 2019-03-20
      • 2019-02-09
      • 1970-01-01
      • 1970-01-01
      • 2017-10-23
      • 2015-06-11
      • 2014-12-02
      • 2011-07-06
      • 1970-01-01
      相关资源
      最近更新 更多