yieldmo / uncrustifier

A simple Xcode 8 extension that wraps https://github.com/uncrustify/uncrustify/
Apache License 2.0
48 stars 7 forks source link

Can we have Uncrustifier uncrustify selected files/folders in Project Navigator? #18

Open foehammer88 opened 7 years ago

foehammer88 commented 7 years ago

For instance, if you select multiple files or groups in Project Navigator and select an option in the Uncrustifier menu bar option "Format Selected Files".

Selecting a top level group and hitting "Format Selected Files" would format all nested files recursively.

Thanks.

harquail commented 7 years ago

Hey @foehammer88 — unfortunately the Xcode SourceEditor API only gives access to the current file's text. Would you be interested in doing this from the separate application (as described in https://github.com/yieldmo/uncrustifier/issues/16) ?

foehammer88 commented 7 years ago

@harquail, Yeah, performing the uncrustify action recursively from the Uncrustifier.app on a remembered directory (so I don't need to select a directory every time I want to run an Uncrustify), would work for me. Essentially, I would like to run uncrustify on all my Obj-C files in my project.

To optimize the action of uncrustifing the directory and sub-directories, you could have an option in the Uncrustifier.app GUI to run uncrustify only on Modified or Added files determined by their containing local git repository.

harquail commented 7 years ago

Cool. It probably makes sense to tackle this in two stages. First formatting all .m and .h files in a folder, then later optimizing to only format only changed files (tracking through git, modification dates, or some other system).

@foehammer88 If you want to take a stab at implementing the first part, we would welcome a PR :). Otherwise, we'll get to this eventually when we have time.

foehammer88 commented 7 years ago

Hey @harquail, thanks, that makes sense. I think that is a good plan of action.

I would like to take a stab at it, unfortunately I don't have a lot of spare time at the moment, so it would probably be best to plan this out for your future sprints. However, if I do find some time in the near future, I can try to implement this, but don't hold your breath.

Thanks for intending to implement this feature, as it would greatly save me (and probably others) time!