使用以下内容进行测试
clang-format -style="{BasedOnStyle: Google, UseTab: Always}" -i /path/to/file.ino
结果以空格而不是制表符显示
Fis*_*ans 11
在内部,clang-format仅适用于空格,直到最后一步它才会用制表符替换空格,然后它只会以TabWidth. 由于 Google 风格已经IndentWidth: 2并且TabWidth: 4不会用制表符替换它们,除非同一行上有两个缩进。
您必须同步IndentWidth并且TabWidth除此之外UseTab它才能在每一行上工作:
UseTab: Always
IndentWidth: 4
TabWidth: 4
Run Code Online (Sandbox Code Playgroud)
您可以使用该UseTab选项,例如:
UseTab: Always
IndentWidth: 8
TabWidth: 8
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11945 次 |
| 最近记录: |