How to avoid reordering when optimize imports

alexpfx

Is there a way to prevents Intellij Idea to rearrange imports when it runs the optimize imports? I want to avoid this since I work on a large codebase where most of others programmers are using Eclipse. When Idea do the optimization (to remove unused imports, for example) it always put these imports to the bottom:

import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.ejb.EJBContext;
import javax.ejb.Local;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.interceptor.Interceptors;
import java.util.ArrayList;
import java.util.List;

And when some eclipse users do the same, it are placed to the top. I want to avoid this, since it may annoy others programmers, since I'm the only one that uses Idea IDE in project.

I've googled about it and found old messages, like: https://youtrack.jetbrains.com/issue/IDEABKL-6456

I would like to know if there is any good way to do this in the newer Idea versions.

The version is: IntelliJ IDEA 2018.1 (Community)

  • EDIT - Some Infos:

The "Optimize imports on the fly" is already unchecked.

Pim Hazebroek

Go to preferences (settings) -> editor -> code style -> java -> imports tab

At the bottom you find the import layout. This will determine the structure if your imports. You should remove everything and just leave import all other imports.

Here is how it should look: enter image description here

Note: don't forget to uncheck Layout static imports separately

Note 2: I'm using 2018.1.2 EAP (Ultimate)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Eclipse Optimize Imports to Include Static Imports

How to avoid circular imports in Python?

How to avoid circular imports in Python?

Avoid repeated imports in Java: Inherit imports?

Intellij auto optimize imports for Go

How to avoid imports with very long relative paths in Angular 2?

How to optimize imports automatically after each save in IntelliJ IDEA

How to configure IntelliJ to use short package names on "Optimize imports" for a scala codebase?

IntelliJ IDEA: how to revoke reformat code / optimize imports dialog?

Gulp/Symfony2: How can I avoid overwriting my js/css imports when cache busting?

How to use pyinstaller with hidden imports for scipy.optimize leastsq

How to get input values to update when reordering items in Elm update

How to avoid circular imports in a Flask app with Flask SQLAlchemy models?

How to avoid ugly imports in TS Triple-Slash Directives

Avoid using environment variables when doing variable imports

Need architectural advice on how to handle and/or avoid circular imports when using Django/DRF

How to optimize this method and avoid foreach loop

How to avoid circular imports?

how to deal with imports when shadowing component

How to optimize the return value of rvalue parameter to avoid copy

How do you avoid circular imports in Python?

How to optimize a PostrgreSQL query and avoid using "NOT IN"?

How to optimize (or avoid as far as possible) loops in Excel VBA

How to avoid line continuations in Python imports

How to avoid duplicate sass imports(using @use) on Webpack

How to Keep Track of colem index when JTable has been Reordering?

How to optimize my query speed (avoid using subselect for every row)?

Avoid reordering of keys when merging JSON objects with jq

How to prevent VSCode from reordering python imports across statements?