有没有办法配置clang格式保持嵌套的命名空间声明在同一行? [英] Is there a way to configure clang-format to keep nested namespace declarations on the same line?

查看:191
本文介绍了有没有办法配置clang格式保持嵌套的命名空间声明在同一行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我正在工作的代码库中,我们总是声明嵌套的命名空间:

In the codebase I'm working in, we always declare nested namespaces thusly:

namespace foo { namespace detail {

// stuff

} }  // foo::detail namespace


b $ b

我还没有找到一种方法来配置 clang-format ,将其分成多行:

namespace foo {
namespace detail {

// stuff

}
}  // foo::detail namespace

周围配置了 BreakBeforeBraces 配置,我在clang 3.8中查看了新的 BraceWrapping 配置,都没有成功。

I've played around with the BreakBeforeBraces configuration, and I've looked into the new BraceWrapping configuration in clang 3.8, both without success.

是否可以在不用 // clang-format [on / off] 注释代码的情况下执行此操作?

Is it possible to do this without annotating the code with // clang-format [on/off]?

推荐答案

事实证明,这是cl格式团队已经考虑的功能,但已被拒绝。有关其他详细信息,请参见 https://llvm.org/bugs/show_bug.cgi?id= 17928

It turns out that this is a feature that has been considered by the clang-format team, but has been rejected. For additional details, see https://llvm.org/bugs/show_bug.cgi?id=17928.

这篇关于有没有办法配置clang格式保持嵌套的命名空间声明在同一行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆