krasa / EclipseCodeFormatter

IntelliJ plugin - use Eclipse's code formatter directly from IntelliJ. https://plugins.jetbrains.com/plugin/6546
Apache License 2.0
487 stars 117 forks source link

Import ordering incorrect when read from Eclipse settings file #130

Closed datalogics-kam closed 7 years ago

datalogics-kam commented 7 years ago

IntelliJ IDEA 2017.1 Build #IC-171.3780.107, built on March 22, 2017 JRE: 1.8.0_112-release-736-b13 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.12.4

Thanks for the plugin! It's allowing me to set up one of our projects to work with both Eclipse and Intellij IDEA. Not having to conform two different formatting systems is a real help.

If I use the org.eclipse.jdt.ui.prefs file containing this line...

org.eclipse.jdt.ui.importorder=\#com.adobe;\#com.datalogics;\#;\#org;\#com;\#java;\#javax;com.adobe;com.datalogics;;org;com;java;javax;

...then the catchall imports (from, say mockit.*) go at the end, instead of before org (note the two semicolons with nothing between them).

But, if I export the import order from Eclipse, and use the resulting file that looks like this:

#Organize Import Order
#Thu Mar 30 14:07:30 CDT 2017
9=
8=com.datalogics
7=com.adobe
6=\#javax
5=\#java
13=javax
4=\#com
12=java
3=\#org
11=com
2=\#
10=org
1=\#com.datalogics
0=\#com.adobe

...it works.

Basically I tried all the things, and this workaround works for me. Hopefully the report will be useful.

krasa commented 7 years ago

Thanks!

datalogics-kam commented 7 years ago

Thanks for such a quick fix! I'd like to try i tout. I'm trying to build the plugin myself, but I'm having trouble with it. I'm not really an expert.

Is there a good set of build instructions? Or could you push out a release?

krasa commented 7 years ago

Install this https://github.com/krasa/EclipseCodeFormatter/releases/download/16.3.132.637.0/EclipseFormatter.zip

datalogics-kam commented 7 years ago

It works! Most excellent! Thank you.