如何告诉clang格式缩进可见性修饰符? [英] How can I tell clang-format to indent visibility modifiers?

查看:87
本文介绍了如何告诉clang格式缩进可见性修饰符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的可见性修改器(公共受保护的私有)由clang-format缩进,当前它们与类声明处于同一级别。我一直在默认格式选项的转储中查找缩进可见性,但找不到任何内容。 / p>

I want my visibility modifiers (public, protected and private) to be indented by clang-format who currently leaves them at the same level as the class declaration. I've looked for indent and visibility on a dump of the default format options but couldn't find anything.

推荐答案

来自 Clang格式的样式选项文档


AccessModifierOffset(int)
的额外缩进或缩进访问修饰符,例如public:。

AccessModifierOffset (int) The extra indent or outdent of access modifiers, e.g. public:.

因此,将适当的条目添加到您的 .lang格式。例如,

So, add the appropriate entry to your .clang-format. For example,

AccessModifierOffset: 2

这篇关于如何告诉clang格式缩进可见性修饰符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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