C/C++ support
fvgh opened this issue · 5 comments
I would like to provide C/C++ formatting support.
The following features shall be initially provided:
- C/C++ formatter based on CDT (see #231)
- Include order changes based on existing code for
ImportOrderStep
- Extension for Gradle/Maven whereas Maven will use default file name extensions and Gradle probably the native-specs (have to do some reading first...)
I provided an example use case. Feedback is welcome.
Formatting accomplished with #295.
Sorting of include
statements still to be supported. Usage of ImportOrderStep
is not a suitable option. CDT offers a highly configurable solution. Aiming to integrate CDT include-organizer.
Hence this issue remains open.
The usage of IncludeOrganizer as it is provided by CDT is not an option.
- The amount of dependencies on other Eclipse components is quite high.
- Only a very small set of options is supported without pre-knowledge of the project setup (knowledge which headers belong to other libraries). Unfortunately even the header substitution is not applied.
- The results differ for the same configuration depending whether it is run with a project or without. This cannot be easily worked-around.
All in all it seems a better idea to implement an own organizer similar to the Spotless Java Import sorter.
I try to keep the issues in-sync with our releases, but I missed this one! We have had C/C++ support since:
- plugin-maven 1.15.0 2018-09-23
- plugin-gradle 3.15.0 2018-09-23
It seems like a missing piece is an include organizer. One option is to build one from scratch, another would be to use clang-format (#475), and follow it up with eclipseCdt()
. Regardless, even without include organizing, it's tremendously valuable to have Eclipse CDT's autoformatter included, thanks so much @fvgh! I'm going to close this as "long-ago implemented", and if you have a specific unmet need, feel free to open a new issue.
As of plugin-gradle 5.2.0
we also support clang-format
. PR for maven welcome :)