[Coding style] Does Idea propose a standalone tool to format java code with .editorconfig ?


I would like to format the java code (and even many other file types) depending on the .editorconfig. I saw Intellij can do it natively, which is great !

But I would like to do the same "without intellij", with a maven plugin or any other tools, triggered with pre-commit git hook for example. I even posted on stackoverflow about this need : https://stackoverflow.com/questions/75801441/how-to-format-java-code-based-on-editorconfig-file

My question is : do you know such a tool ? Do Idea propose an open-source tool to format code ? Since Intellij can do it, it should be easy for you to externalize the tool and create a maven plugin to use it, maybe you have already done it ?

I saw there is a maven plugin using .editorconfig, but there is no java linter.

Any advice are welcome, thank you.

评论操作 固定链接

Hello Lacaute Yannick. Unfortunately, JetBrains does not offer a tool or plugin for this purpose. We know that such a product could be highly desirable and in-demand, but we are constrained by limited resources, and the undertaking of such a project would require a significant amount of effort from our team.

We have a similar feature request in our YouTrack, and my colleague has provided a detailed explanation (for instance, in this comment) of the difficulties involved in creating a standalone formatter. Although this feature request is presently shelved (meaning that we do not intend to develop it in the near future), you can express your interest in its implementation by upvoting it and encouraging your colleagues who may also be interested in it to do the same. We frequently review issues that receive a substantial number of votes, so if our customers genuinely demand this feature, we may reconsider our decision and begin development.