How to setup clang format in VSCode and VS2017 - Cidana-Developers/Cidana-Task-Manager GitHub Wiki

Guide to Setup Visual Studio Code

Visual Studio Code is a platform independent tool for source code editing, compiling and debugging; it can work on Windows, MacOS and Linux (Ubuntu, etc...)

  1. Download and install Visual Studio Code from: Here Image1

  2. Install following extensions for C/C++:

  • C/C++
  • C++ Intellisense
  • Clang-format Image2
  1. Setup for clang-format:
  • Download clang-format executable from: http://llvm.org/builds/, and placed in any path, e.g. c:\clang-format\clang-format.exe
  • Add configuration in “Settings.json”:

"clang-format.executable": "C:\\clang-format\\clang-format.exe",

"editor.formatOnSave": true,

"clang-format.style": "file",

"extensions.ignoreRecommendations": true,

  • Clang-format.sytle option can be: “llvm”, “google”, “chromium”, “mozilla” and “webkit”, and “file” is for a user defined configuration, user can create a file named “.clang-format” through https://zed0.co.uk/clang-format-configurator/ or export “clang-format.exe -style=google -dump-config” and modify for your own style.

Guide to Setup Visual Studio Code

  1. Install Clang-format extension from http://llvm.org/builds/ or from extension market PS: Download clang-format executable from: http://llvm.org/builds/, and placed in any path, e.g. c:\clang-format\clang-format.exe

  2. Setup in “Options”-->Text Editor-->Formatting-->General, and add your clang-format.exe path Image3