Reputation: 9
I have a project in IAR embedded workbench. Is there a way using the tools menu to add in a code formatter such as clang-format? I've managed to call it, but have not set the command line options correctly in order to feed the current file into the formatter.
Simon
Upvotes: 0
Views: 1550
Reputation: 9
Yes it is possible:
Here are the settings I used.
Menu Text: Clang Format
Command: C:\Program Files\LLVM\bin\clang-format.exe
Argument: --style=file $FILE_PATH$ -i
Initial Directory: $FILE_DIR$
These settings require a file .clang-format to be saved in the project directory, no bad thing in my view as if checked in with the project it sets a standard for the project code format.
I think simply using clang-format for the command would work if the directory is added to the PATH environment variable. Or you'll need to browse to the location of clang-format on your system if it's different you mine.
Upvotes: 0