Closed GoogleCodeExporter closed 9 years ago
nope, those things are used by some eclipse internals...
import order and optimizing can be specified directly in intellij.
Original comment by vojta.kr...@gmail.com
on 9 Mar 2012 at 6:43
Right, I know IntelliJ supports import ordering, but the point of using the
Eclipse settings would be to use the exact same import settings that the
Eclipse devs on my team are using, without having to manually keep my IntelliJ
settings in sync with those - pretty much the same reason you created this
Eclipse code formatter plugin I think.
Original comment by ian.spri...@gmail.com
on 9 Mar 2012 at 9:55
yes, you are right, it should be done.
Original comment by vojta.kr...@gmail.com
on 9 Mar 2012 at 10:01
I'm having a issue regarding the imports. It seems like that if Eclipse finds a
package that is not part of the defaults ones (java,javax,org,com) he inserts
the import alphabetically so for example:
import java.util.Collection;
import nl.something;
import org.springframework.web.bind.annotation.RequestMapping;
So since nl is not a default package by eclipse he inserts it alphabetically
where IntelliJ always inserts in the end not caring about ordering.
import java.util.Collection;
import org.springframework.web.bind.annotation.RequestMapping;
import nl.something;
Do you know of a way to fix this?
Original comment by rafael.s...@gmail.com
on 14 Mar 2012 at 1:26
well, i just use in the Import Layout following entries:
import static all other imports
<blank line>
import all other imports
Original comment by vojta.kr...@gmail.com
on 14 Mar 2012 at 1:32
for custom order would be needed to implement import line sorter. :/
Original comment by vojta.kr...@gmail.com
on 14 Mar 2012 at 1:43
It's not even about a custom order, it's just how eclipse works. First he
orders everything than all the remaining he inserts it in a alphabetically
order, and what you mentioned means that all other imports will always come in
the end, which results in a different behavior than from eclipse... :(
So every time I use your plugin I need to organize imports manually, otherwise
it will not work.
Original comment by rafael.s...@gmail.com
on 14 Mar 2012 at 4:48
if you would not use custom order in Eclipse, then there would be no problem
imho.
intellij alphabetically sorts too, so it should be identical.
Original comment by vojta.kr...@gmail.com
on 14 Mar 2012 at 5:18
I played a little with eclipse and with it's import order, but it just does not
make any sense... the alghoritm is piece of shit. There is no way I could write
a line sorter.
The best you can do is not use any custom order both in eclipse and in
intellij, or provide a fix :]
Original comment by vojta.kr...@gmail.com
on 14 Mar 2012 at 8:36
I actually understand the way eclipse works. First he looks at the sorting
order of the imports. By default is:
java
javax
org
com
Then for all other packages, instead of putting it in the end like IntelliJ, he
places them alphabetically. So for example a package of nl would be
java
javax
nl
org
com
And a package of pt would be
java
javax
org
pt
com
It's weird, but it sucks that one cannot integrate fully a environment between
eclipse and intellij... :(
Original comment by rafael.s...@gmail.com
on 15 Mar 2012 at 9:09
with default settings it makes this from my imports:
import java.util.HashMap;
import java.util.Map;
import org.jingle.mocquer.MockControl;
import sun.security.action.GetLongAction;
import tmplatform.authorisation.ApiClientLink;
import base.LoadUnitTestDataTestCase;
import com.sun.rmi.rmid.ExecOptionPermission;
how is it that base is where it is?
and with:
java
javax
com
org
it makes this:
import java.util.HashMap;
import java.util.Map;
import base.LoadUnitTestDataTestCase;
import com.sun.rmi.rmid.ExecOptionPermission;
import org.jingle.mocquer.MockControl;
import sun.security.action.GetLongAction;
import tmplatform.authorisation.ApiClientLink;
Original comment by vojta.kr...@gmail.com
on 15 Mar 2012 at 9:47
So by looking at your second example:
First he puts java:
import java.util.HashMap;
import java.util.Map;
Then he puts com:
import com.sun.rmi.rmid.ExecOptionPermission;
Then he puts org:
import org.jingle.mocquer.MockControl;
Then what he does is the remaining imports since they are not defined as
default ones, he will insert them order alphabetically, so put "base" before
"com" and sun/tmplatform after org.
It's weird logic, but I understand the algorithm behind it.
Original comment by rafael.s...@gmail.com
on 15 Mar 2012 at 10:23
yes, the second one i understand, but the first one?
Original comment by vojta.kr...@gmail.com
on 15 Mar 2012 at 12:46
But it's strange, because the default settings in my eclipse are with:
java
javax
com
org
So it should always fall under the second case. I'm using Eclipse Indigo, but I
think this was always like that.
Original comment by rafael.s...@gmail.com
on 15 Mar 2012 at 12:51
Attachments:
i have indigo too with same settings. i think it is broken.
Original comment by vojta.kr...@gmail.com
on 15 Mar 2012 at 12:54
Maybe, because all developers here have the same default settings in eclipse
which are the:
java
javax
com
org
So it would mean that the algorithm is always the same, a weird one I agree,
but always the same :)
Original comment by rafael.s...@gmail.com
on 15 Mar 2012 at 12:56
hmm i get it, it inserts groups by configuration:
import java.util.HashMap;
import java.util.Map;
import org.jingle.mocquer.MockControl;
import com.sun.rmi.rmid.ExecOptionPermission;
and then:
import sun.security.action.GetLongAction;
import tmplatform.authorisation.ApiClientLink;
after the org.
and import base.LoadUnitTestDataTestCase;
before the com.
Original comment by vojta.kr...@gmail.com
on 15 Mar 2012 at 1:00
Wicked!!!
Do you think it would be possible to implement this? Otherwise I'm kind stuck,
because if it changes the order of the imports, then I get diffs in SVN :(
Original comment by rafael.s...@gmail.com
on 15 Mar 2012 at 1:04
i think it should take about 30 minutes :-)
Original comment by vojta.kr...@gmail.com
on 15 Mar 2012 at 1:08
You're my hero! It's official :D
Original comment by rafael.s...@gmail.com
on 15 Mar 2012 at 1:10
I could not have done it without you :)
you can try new version.
Original comment by vojta.kr...@gmail.com
on 16 Mar 2012 at 9:39
i formatted whole project and it seems to work.
btw custom order of static imports is not implemented.
Original comment by vojta.kr...@gmail.com
on 16 Mar 2012 at 9:43
Hey!!
I just tested and it works great! Awesome work!
Just one improvement:
The default import order in Eclipse is java;javax;org;com; and not
java;javax;com;org as you have by default. After changing this it works just
fine!
I'll let you know further if everything is fine. Right now it seems so :)
Cheers!
Original comment by rafael.s...@gmail.com
on 16 Mar 2012 at 11:10
damn, stupid mistake :-)
Original comment by vojta.kr...@gmail.com
on 16 Mar 2012 at 11:12
version 1.7 can load preferences from the file
Original comment by vojta.kr...@gmail.com
on 26 Mar 2012 at 3:12
Original issue reported on code.google.com by
ian.spri...@gmail.com
on 9 Mar 2012 at 6:38