How to more easily manage Java code reformatting in mixed IDEA/Eclipse env
I'm working in an a team with mostly Eclipse users, and I recently switched to Intellij on the project. All's well for the most part, I love the many easy to use productivity features, but I find dealing with Code reformatting more painful than I would like.
I'd like to easily (i.e. without thinking about it) only format Java code when I commit (or when I save for that matter). I don't want to format any other file types (xml, html, etc) other than Java code, because we can't get Eclipse and Intellij to play nice when it comes to reformatting non-Java files exactly the same way. Reformatting files the same no matter who checks in is critical for file difference checking for code review and viewing history. So we have elected to not auto-reformat non-Java files, but rather just format the areas we are working on with informal standards.
In Eclipse, one can achieve this with the "Save Action" concept, which in their case, can allow you to reformat just Java files on Save. I don't see the equivalent feature in IDEA.
The closest thing I have found so far in IDEA is the ability to reformat during a check-in, but that doesn't appear to allow one to selectively say which types are reformatted. I haven't found any "auto-reformat on save" options either.
So, now my workaround commit process is:
In the changes view, select only the Java files, then enable the "organize imports" and "reformat code" check then hit commit. Then I select the rest of the files (the non-java files) , deselect "organize imports" (which would alter jsp files), and "reformat code" and then commit those files. Non-only is this a multi step process where there could just be one, but it's easy to accidentally commit with the settings on or off and then suddenly be the bad code citizen who reformatted some non-java code, or didn't format some Java code.
Perhaps if I could completely disable all other types of code formatting other than Java, I could commit, but then I would lose the ability to code format "selected text" of jsp's etc to manually format just code that I am changing.
Any thoughts?
请先登录再写评论。
Tom Wadzinski wrote:
]]>
Very good point... I definitely agree this needs to be more configurable.
N.
Yup. I am using a Trinidad flavor of CSS files (some extensions to CSS).
Reformating them in Idea simply breaks them.
However I still want to have java files reformatted automatically.
I you file a request at http://www.jetbrains.net/jira/ I will surely vote for it.
Searching JIRA, there are a handful of such requests already that have gotten no response as far as I can see:
http://www.jetbrains.net/jira/browse/IDEABKL-1194
http://www.jetbrains.net/jira/browse/IDEABKL-3347 (this seems to be the "master")
http://www.jetbrains.net/jira/browse/IDEA-5077
Though the issue IDEABKL-3347 has been assigned and open going back to 2005, I have voted for it (I'm the only vote so far) and commented on this issue, linking back to this forum discussion.
Any suggestions on how to best further stir the attention of the JetBrain folks?
Bump.
It would be helpful if someone from JetBrains could acknowledge that they have seen this discussion and/or the related JIRA item, and any thoughts they have about it. So far there has been no JetBrains response that I have found.
JIRA item:
http://www.jetbrains.net/jira/browse/IDEABKL-3347
Thanks,
Tom
Bumping again.
Any chance someone from Jetbrains could respond to this and the associated JIRA item?
http://www.jetbrains.net/jira/browse/IDEABKL-3347