Prepare Visual Studio Code to Work with Google's C++ Style Guide
Firstly, the reader should have "C/C++ Extension Pack" distrubed by Microsoft.
- Click the File tab, and select Settings from Preferences menu.
- Search for
Clang_format Style
. It has to give you two important result:C_Cpp: Clang_format_fallback Style
andC_Cpp: Clang_format_style
. - Change both of these settings' textboxes to "Google".
- Close the settings panel, it should work now.
To format the document in a click,
- Press
CTRL+SHIFT+P
to open command panel of Visual Studio Code. - Type "Format Document" and find the command. Click it.
Now, the file has to be changed to given format -- in our case, Google's.
Warnings of Style
The best part of using IDEs is to have warnings when the style guide is not followed by the programmer. To use this feature with Google's C++ Style Guide, we can install the extension named "cpplint" in Visual Studio Code's marketplace. Please check the distrubitor's name if it is "mine". Find the extension, and install it. All the C and C++ files will have a warning section about styling in the "Problems" panel.