Search code examples
c++netbeansclang-format

Can clang-format be used in Netbeans versions greater than 8.2


I am currently using newest Netbeans version 17 with C/C++ plugin from Netbeans 8.2 Plugin Portal.

Is there a way to use clang-format as shown in this answer?

When I open project properties -> Formatting, I can choose between "Use global formatting style" and "Use project specific formatting style" but not "Use clang-format".


Solution

  • I wrote the answer that you referred to, and unfortunately the situation is that it is no longer possible to use clang-format in NetBeans. It's possible to be definitive about this because you are (understandably) trying to use the old C/C++ plugin from NetBeans 8.x, but that plugin is specifically no longer supported.

    A fairly recent Apache NetBeans Bug Report (Unable to build c/c++ EFL) has nothing to do with your specific problem, but it contains these authoritative comments from the NetBeans team with regard to the old C/C++ plugin:

    The C/C++ plugin is not part of the Apache NetBeans project, so we can't do anything about issues with it directly. This code may be released by Apache NetBeans in future.

    ...there is a branch here with the code already (it was always open-source, and was donated) - it's just not in a releasable state. https://github.com/apache/netbeans/tree/cnd

    It's a shame because that plugin worked well, and the currently supported alternative (the CPPLite plugin) is not as good. I don't know for sure, but I suspect that the old plugin is no longer supported for licensing/legal reasons associated with NetBeans moving to Apache rather than any technical issues.

    So if you have somehow got the old C/C++ plugin working with NetBeans 17, just bear in mind that its use is unsupported, and this may not be the only functionality issue you encounter.