Code formatting

.clang-format

For automatic formatting of project files, the file format_all_files.bat is located in the root of the repositories.

It essentially calls .clang-format on all project files:

@echo off
CD Source
FOR /R %%f IN (*.cpp, *.h, *.cs) DO (
    clang-format -i %%f
    echo %%f
)

In order for the script to work correctly, you need to add the path to clang-format to your PATH environment variable. The program is located in the Visual Studio directory. 99% that you have the same path:

c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\bin\

How to set an environment variable

In the Windows search, enter environment and open System Properties:

Click on Environment Variables:

Select Path and click on Edit:

Insert the path to clang-format into the list, click on OK:

You can check that everything is ok on the command line using one of the commands:

clang-format -version

where clang-format

The output should be as follows:

After that, you can use the script format_all_files.bat

Code Formatting Plugins for Visual Studio

Last updated

Was this helpful?