benoitsan / BBUncrustifyPlugin-Xcode

Xcode plugin to format source code using ClangFormat or Uncrustify
MIT License
1.19k stars 150 forks source link

Can't get cmt_insert_file_header working #76

Closed ericb0774 closed 9 years ago

ericb0774 commented 9 years ago

I have a file named FileHeader.h in the root dir of my project.

My uncrustify.cfg file is also in my root project dir. The option in the file looks like this:

cmt_insert_file_header = "FileHeader.h" # string

I have the BBUncrustifyPlugin option to format on save enabled. My other uncrustify rules are being applied to the current file upon saving, but the file header is not being inserted. I do not have a C/C++ comment at the top of my source file.

Any suggestions? I have tried specifying a full path to the FileHeader.h, and moving the file to different directories, but I cannot get it working.

Thanks!

benoitsan commented 9 years ago

Thank you Eric, it was a bug and it should be fixed now.

Example:

I have _uncrustify.cfg in a Xcode project root folder.

In _uncrustify.cfg:

cmt_insert_file_header = "header.h"
utf8_force = true # needed if you are using utf-8 characters in header.h

header.h

//
// Created by Benoît Bourdon
// Copyright (c) 2015
// $(filename)
//

If needed, you can test your config with the command line ./uncrustify -l OC -c /path/to/_uncrustify.cfg -f /path/to/file.m