Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing code style formatting settings into eclipse from intellij-idea

I've recently implemented the maven Check style plugging into my project and have changed all of the formater Settings in intellij (Which I use) to conform to this style guide (which they now do).

However I need to produce a settings .xml file for eclipse, so that my colleagues can automatically format there code so that it also conforms to this style guide.

The problem I am finding is that I cannot see a way of exporting the settings from intellij and importing them into eclipse. and I cannot manually configure eclipse to conform with the nuances of the new style guide (Continuation indentation being the main problem).

Any help or Ideas would be fantastic. :)

like image 989
Luke_P Avatar asked Apr 05 '16 16:04

Luke_P


2 Answers

There is a EditorConfig - independent format for editors/IDEs code style configuration. There are EditorConfig plugins for most popular editors(see full list here).

You can see examples for IntelliJ IDEA(tutorial) and Eclipse(plugin page).

like image 135
user13989500 Avatar answered Sep 18 '22 12:09

user13989500


I couldn't find a ready plugin for that in 2018. So here is a side by side code style configuration from UI perspective of Intellij IDEA 2017.3 and Eclipse OXYGEN.3 March 2018. If both configured this way the code will be formatted close enough, so for example github will show you code differences so that it make sense.

For our project we configured one XML for each IDE so they more or less match:

  • IntelliJ Config File is default of IDEA 2017.3 so not much to define in XML - enter link description here
  • Eclipse Config is modified a bit from the default to match IntelliJ - link
  • Here is also a PDF file to show all the options set in both IDEs side by side - link

There is also a project to solve this problem across more IDEs(Answer) : EditorConfig

like image 44
Constantin Zagorsky Avatar answered Sep 21 '22 12:09

Constantin Zagorsky