小编Joe*_*ico的帖子

使 clang 格式的订单以不区分大小写的方式包含

我正在尝试配置 .clang-format。我的目的是让它保留我的包含组,因为它们在代码中,但按字母顺序对它们进行排序。我设法接近我想要的IncludeBlocks: Preserve,但它以区分大小写的方式包含在每个块中:

这是我应用格式后得到的结果

#include "A1.h"
#include "B2.h"
#include "a2.h"
#include "b1.h"
Run Code Online (Sandbox Code Playgroud)

这就是我想要实现的目标

#include "A1.h"
#include "a2.h"
#include "b1.h"
#include "B2.h"
Run Code Online (Sandbox Code Playgroud)

我正在使用 clang-format 版本 10.0。我的 .clang 格式文件,以防相关:

---
# Brompton's Clang Format file v0.0.1
#
# Changelog:
# v0.0.1 (25/9/2020):
# - First version of this file


# Base it on Google's Standard, with 4 spaces as indentation
BasedOnStyle: Google
IndentWidth: '4'
Standard: Cpp11
UseTab: Never

# Settings for C/C++
Language: Cpp
# 120 chars per line, reflow …
Run Code Online (Sandbox Code Playgroud)

c++ clang-format

5
推荐指数
1
解决办法
3365
查看次数

标签 统计

c++ ×1

clang-format ×1