tags: A little white note in work visual studio code
Need to install the plug-in C / C ++, it is not recommended to use the CLANG-Format plugin. After all, C / C ++ has supported the Clang-Format formatting operation. There is also a benefit of installing this clang-format plugin, with Clang-Format. In order to simplify the VSCode setting interface, I will choose to install independently.
First update the installation software, (If you don't update the installation package, there is a pit, you can understand why it), execute Brew Upgrade, this process is a bit slow, you can learn how to skip the updated software, and finally execute Brew Install LLVM
Find Clang-Format Path: Find / usr -name clang-format, my path is: /usr/local/cellar/llvm/11.1.0_1/bin/clang-format
New directory Demo, store two files: .clang-format, demo.cpp
The .CLANG-FORMAT is stored in the form of a custom code format rule in the form of the key: value: Value, the rule is described:http://clang.llvm.org/docs/ClangFormatStyleOptions.html
Vscode configuration file has three, user configuration, work space configuration, folder configuration (need to know yourself)
Settings.json in the user directory I configured, add the content in the settings.json file:
"C_Cpp.clang_format_path": "/usr/local/Cellar/llvm/11.1.0_1/bin/clang-format",
"C_Cpp.clang_format_fallbackStyle": "Visual Studio",
"C_Cpp.clang_format_style": "file",
Save, edit the code within DEMO.CPP, right click on the formatted document, select C / C ++, then click, and format the document.
clang-format is a tool to automatically format C/C++/Objective-C code, so that developers don't need to worry about style issues during code reviews. installation Common commands are as...
Clang-Format is a universal code typesetting plugin that can be used in multiple languages and multiple IDEs Clang-Format full style description can be viewed in the official documentation:ClangForm...
Series article catalog Article catalog Series article catalog Foreword First, Clang-Format Second, use steps 1, Visual Studio Code installation Clang-Format 2, install Clang-Format in the command line...
1 Overview Clang-format is used to format the code, with the comes with the contained rules:LLVM、Google、Chromium、Mozilla、WebKit 2. Command Install command:sudo apt install clang-format Operation comma...
The previous article mentioned some rules validation for canceling eslint. Similarly, we can modify the formatting configuration and add the appropriate rules. Proceed as follows First download the pr...