question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

organize-imports dosn't respect `groups` settings

See original GitHub issue

Actual behavior

With configuration

OrganizeImports {
  # IntelliJ IDEA's order so that they don't fight each other
  groups = [
    "java."
    "*"
    "scala."
  ]
}

organize-imports of version 0.3.0 turns

...
import scala.io.AnsiColor
import scala.language.postfixOps
import scala.sys.process._

into this

...
import scala.io.AnsiColor
import scala.sys.process._

import scala.language.postfixOps

almost as if the config were

  groups = [
    "java."
    "*"
    "scala."
    "scala.language"
  ]

But that’s not the case.

Expected behavior

given the config above, organize-imports should preserve this ordering

...
import scala.io.AnsiColor
import scala.language.postfixOps
import scala.sys.process._

Note

This is a problem which prevents us from adopting organize-imports, because this fights with IntelliJ’s Optimize imports.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
lianchengcommented, May 8, 2020

@sideeffffect, PR #42 should be able to solve your issue.

You may use the 0.3.0+1-5c3e2618-SNAPSHOT snapshot release to try it out.

0reactions
lianchengcommented, May 14, 2020

@sideeffffect, 0.3.1-RC1 has been cut. A few issues were found. Sorry for the delayed release!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Organize Imports Doesn't Respect "Groups" (#78553) - GitHub
0. Description: When using "Organize Imports", import "groups" are ignored. Instead, each group should be treated individually, retaining import ...
Read more >
Visual Studio code Organize imports feature - Stack Overflow
On my project I have a max-line lenght configuration, but the import plugin doesn't seem to respect this. Shouldn't it? I'm asking this ......
Read more >
Optimize Imports doesn't respect import groups : WEB-43661
The Optimize Imports action should respect the import groups, as delineated by blank lines. Merging/sorting should only occur within a group.
Read more >
scalacenter/scalafix - Gitter
I found that this approach doesn't respect the suppression warning in the following case: ... rules = OrganizeImports OrganizeImports.groups = ["scala.
Read more >
194358 – [import rewrite] Organize Imports produces wrong ...
Set The issue is that import organizing doesn't use packages and types, but instead groups and packages in org.eclipse.jdt.internal.core.dom.rewrite.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found