c++ - Clang-format 不使用 .clang-format 文件 ubuntu(无错误)
问题描述
我的.clang-format
项目目录中有一个 .cpp 文件和构建目录。从我的终端我 cd 进入我的项目文件夹并运行clang-format -style=file -i *.cpp
. 这是我的.clang-format
文件。
Language: Cpp
ColumnLimit: 0
BreakBeforeBraces: GNU
BreakConstructorInitializers: AfterColon
Cpp11BracedListStyle: true
IndentCaseLabels: true
NamespaceIndentation: All
IndentWidth: 4
TabWidth: 4
UseTab: Never
DerivePointerAlignment: false
PointerAlignment: Left
IncludeBlocks: Regroup
我正在通过更改来测试功能BreakBeforeBraces
,但没有任何变化。它似乎正在使用后备格式。这是怎么回事?有没有办法查看clang-format
实际在做什么?
解决方案
使用 时-style=file
,每个输入文件的 clang-format 将尝试查找位于输入文件最近的父目录中的 .clang-format 文件。使用标准输入时,从当前目录开始搜索。
您可以使用下面的命令查看运行目录中使用的实际配置
clang-format -style=file -dump-config
推荐阅读
- flutter - AutoCompleteTextField not Showing json Data Flutter
- reactjs - firebase can't delete/update from first item on the list (React js)
- javascript - 如何从承诺响应中获取价值并将其分配给 Ionic v3 中数组中的每个对象属性
- php - symfony 4.4获取会话ID并根据匹配的会话ID删除mariadb中的记录
- spring-boot - 检查spring boot生成的jar
- sql - 从 SQL Sever 中的字符串模式中提取前后字符串
- css - 横幅图像不会在移动设备上调整大小
- gatsby - 如何在自行创建的 JavaScript 文件中使用环境或操作系统变量
- php - Artisan::call('migrate') 卡在列重命名中
- python - 用 Boost.python 覆盖 Python 中的 C++ 虚函数?