Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clang-format plugin for visual studio 2017

I'm switching to visual studio 2017. The clang-format plugin does not seem to be compatible with this version yet.

Is there a way to force visual studio to use the old plugin anyway ? Is it compatible ?

Is there a not yet released version of the plugin that I can find somewhere or build myself ?

like image 515
Guillaume Gris Avatar asked Mar 22 '17 15:03

Guillaume Gris


People also ask

How do I install clang formatter?

You can install clang-format and git-clang-format via npm install -g clang-format . To automatically format a file according to Electron C++ code style, run clang-format -i path/to/electron/file.cc . It should work on macOS/Linux/Windows.

Where is clang-format install?

clang-format is located in clang/tools/clang-format and can be used to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.

How do I run clang-format on Windows?

Getting Started with Clang-Format If you want to use it on Windows, you need to use Alter+Shift+F. If you do not have Clang-Format installed on your system, you will see the prompt: The 'clang-format' command is not available.


2 Answers

I checked the clang mailing list and it looks like Hugo Puhlmann's already done the changes but hasn't submitted a patch yet:

  1. http://lists.llvm.org/pipermail/cfe-dev/2017-January/052243.html
  2. http://lists.llvm.org/pipermail/cfe-dev/2017-January/052251.html
  3. http://lists.llvm.org/pipermail/cfe-dev/2017-January/052253.html
  4. http://lists.llvm.org/pipermail/cfe-dev/2017-January/052484.html

Update: Just sent him a message on Twitter. He responded:

"I'll have a look at it today and submit an updated build, since there seems to be more interest on it."

Update (again): Hugo's posted a link to his build below.

like image 179
parsley72 Avatar answered Oct 31 '22 05:10

parsley72


Actually, you can

  1. Download the latest Clang-format for visual studio 2013 and then
  2. Unpackage the *.vsix file with 7-zip
  3. Add one section like the section in the "extension.vsixmanifest" xml file to suuport VS2013 and change the version to "15.0"
  4. Then re-package all the files to a zip archive with 7-zip and rename its extension to *.vsix.

Now you have a clang-format extension installation package supports VS2017.

like image 26
base64k Avatar answered Oct 31 '22 05:10

base64k