转自:https://blog.csdn.net/core571/article/details/82867932?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1
前提条件
安装扩展C/C++,扩展程序将自动安装clang-format。clang-format默认安装路径为c:\Users\wqr57.vscode\extensions\ms-vscode.cpptools-0.18.1/bin/../LLVM/bin/clang-format.exe
首选项设置
打开首选项设置(ctrl + ,),搜索format .
可勾选format on save 自动保存。
C_Cpp: Clang_format_style 决定格式化形式,若为file,则调用在workspace中的.clang-format
C_Cpp: Clang_format_fallback Style ,若上图变量为file,但无.clang-format文件则按照此处规则。
.clang-format
powershell中输入
clang-format -style=llvm -dump-config > .clang-format
产生模板
决定自定义格式化
Original: https://www.cnblogs.com/x_wukong/p/12643095.html
Author: 明明是悟空
Title: VS Code C++ 代码格式化方法(clang-format)
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/536245/
转载文章受原作者版权保护。转载请注明原作者出处!