1This directory contains a VSPackage project to generate a Visual Studio extension 2for clang-format. 3 4Build prerequisites are: 5- Visual Studio 2015 6- Extensions SDK (you'll be prompted to install it if you open ClangFormat.sln) 7 8The extension is built using CMake to generate the usual LLVM.sln by setting 9the following CMake vars: 10 11- BUILD_CLANG_FORMAT_VS_PLUGIN=ON 12 13- NUGET_EXE_DIR=path/to/nuget_dir (unless nuget.exe is already available in PATH) 14 15example: 16 cd /d C:\code\llvm 17 mkdir build & cd build 18 cmake -DBUILD_CLANG_FORMAT_VS_PLUGIN=ON -DNUGET_EXE_DIR=C:\nuget .. 19 20Once LLVM.sln is generated, build the clang_format_vsix target, which will build 21ClangFormat.sln, the C# extension application. 22 23The CMake build will copy clang-format.exe and LICENSE.TXT into the ClangFormat/ 24directory so they can be bundled with the plug-in, as well as creating 25ClangFormat/source.extension.vsixmanifest. Once the plug-in has been built with 26CMake once, it can be built manually from the ClangFormat.sln solution in Visual 27Studio. 28 29=========== 30 Debugging 31=========== 32 33Once you've built the clang_format_vsix project from LLVM.sln at least once, 34open ClangFormat.sln in Visual Studio, then: 35 36- Make sure the "Debug" target is selected 37- Open the ClangFormat project properties 38- Select the Debug tab 39- Set "Start external program:" to where your devenv.exe is installed. Typically 40 it's "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" 41- Set "Command line arguments" to: /rootsuffix Exp 42- You can now set breakpoints if you like 43- Press F5 to build and run with debugger 44 45If all goes well, a new instance of Visual Studio will be launched in a special 46mode where it uses the experimental hive instead of the normal configuration hive. 47By default, when you build a VSIX project in Visual Studio, it auto-registers the 48extension in the experimental hive, allowing you to test it. In the new Visual Studio 49instance, open or create a C++ solution, and you should now see the Clang Format 50entries in the Tool menu. You can test it out, and any breakpoints you set will be 51hit where you can debug as usual. 52