benoitsan / BBUncrustifyPlugin-Xcode

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

Added ability to use uncrustify configuration file located in project root directory #54

Closed amarcadet closed 10 years ago

amarcadet commented 10 years ago

I found useful to share configuration file with other team members, so I have added the ability to share uncrustify configuration file by putting it at the project root directory.

I have let some logs if you want to check the behavior.

Also I have shared the scheme that allows to easily debug the plugin by setting Xcode as the executable.

Hope you like it.

Cheers

benoitsan commented 10 years ago

Merci Antoine.

I looked at your PR and I'm not sure that adding the project root directory is needed.

The actual implementation looks for the configuration file in the current directory or any parent directories of the source file (and so also in the project root directory).

This is how Clang Formatter works (Clang doesn't have any argument to specify the configuration) and I use the same mechanism for Uncrustify in order to have the same workflow for the 2 formatters.

This is also explained in the preferences window http://cl.ly/V9vv

Could you tell me why the actual implementation was not enough in your case?

amarcadet commented 10 years ago

Nevermind, don't know how I missed it... :confused:

At first I wanted to be able to scan the whole workspace tree in case the uncrustify.cfg file was in a sub directory config or something like that. But I stopped my research and rolled it back to a version looking in the current working directory.

I think I can close this PR !

Sorry for the inconvenience :smile:

benoitsan commented 10 years ago

That's what I did in the previous version (when Clang was not implemented). Since Clang implementation, I'm using the logic of Clang for both formatters.

I cherry pick your debug Xcode scheme.