-
Notifications
You must be signed in to change notification settings - Fork 22
organize-imports dosn't respect groups
settings
#40
Comments
@sideeffffect, this is expected behavior because package a
import a.c._
import a.b.i
object b {
implicit val i: Int = ???
}
object c {
implicit val i: Int = ???
val d: Int = ???
}
object Implicits {
def f()(implicit i: Int): Unit = println(d * i)
f()
} If you run IntelliJ import optimizer against the above example, those two imports will be reordered and a compilation error is introduced:
However, in your case, there's no conflicting implicits, and I admit that it's unintuitive to group Since this conflicting implicits issue is pretty rare, maybe we can have an option for keeping IntelliJ compatibility and disable this behavior, and users may use it at their own risks. |
@liancheng IntelliJ compatibility mode would be great! 🙏 |
@sideeffffect, PR #42 should be able to solve your issue. You may use the |
Amazing work, thank you so much @liancheng ! I will test this first thing on Monady |
Ok, I can happily confirm it works fine, at least on my minimal project |
@sideeffffect, glad to hear that :) Although the
One alternative I'm considering is to special case implicits under the
So the proposed approach is to special-case What do you think? |
I'm still worried that it would (or could, in some circumstances, if not for It's amazing that The proposal regarding Does that make sense? |
@sideeffffect, I cannot promise that
As for explicitly imported implicits, as described above, special-casing Another reason why I prefer neither |
fair enough |
Thank you for your input, @sideeffffect! PR #48 implements the new proposal. I'll make 0.3.1-RC1 once it's merged. |
@sideeffffect, 0.3.1-RC1 has been cut. A few issues were found. Sorry for the delayed release! |
Actual behavior
With configuration
organize-imports
of version0.3.0
turnsinto this
almost as if the config were
But that's not the case.
Expected behavior
given the config above,
organize-imports
should preserve this orderingNote
This is a problem which prevents us from adopting
organize-imports
, because this fights with IntelliJ's Optimize imports.The text was updated successfully, but these errors were encountered: