How to close intellij auto sort imports? - intellij-idea

IDEA version : 2019.3.1 x64
I know Settings | Code Style | Java | Imports,
but not found where close;
I don't like idea auto change original import order.
how to close IDEA self-assertion function.Thanks!

in Settings > General > Auto Import uncheck Optimize imports on the fly. Also while reformatting, you may disable it by unchecking Optimize Imports in Reformat Code Dialog.

Related

IntelliJ Idea intellisense does not show java.utils.List

From a moment on my IntelliJ Idea does not show java.utils.List class in Intellisense. This appens ONLY for java.utils.List all other classes are shown.
Is there a specific settings I inadvertently changed?
Navigate to Preferences/Settings | Editor | General | Auto Import and delete java.util.* pattern from the Exclude from auto-import and completion list.

How to sort imports in alphabeticall order in Intellij?

Is it possible to force IntelliJ to order imports alphabetically?
So it should add import in lexicographical order and sort all imports that are not in good order when formatting the code.
Reformatting code optimizes the imports by default, but it is also possible to invoke Code | Optimize Imports separately.
You can configure the order of imports in:
Preferences/Settings | Editor | Code Style | Java. Select the Imports tab and look under the Import Layout header at the bottom.
By default, imports are alphabetically ordered, except for the java.* and javax.* imports.
I had the same problem. Building on what #bas-leijdekkers said that the default sort order is alphabetical, I was able to get my imports in the correct alphabetical order demanded by checkstyle, by doing this:
go into File > Settings
Go into Editor > Code Style > Java, Imports tab
Delete all entries in the "Import Layout" table. I had several in here by default, and maybe you do too. Note you cannot delete the "all other imports" entries, but you can reorder them depending upon your checkstyle requirements.
Click OK.
Then, use the Optimize Imports action in any offending file.
This worked for me, hope it helps you.

How to disable import groups for Java projects in IntelliJ CE?

The optimization of imports seems to be configured in Editor | General | Auto Import. This however doesn't seem to allow to control how imports are grouped (separated with blank lines based on common prefix in package name) and sorted (I'd like to turn grouoping off while still sorting imports automatically and removing unused imports).
I'm using IntelliJ IDEA 2018.3.4 (Community Edition) von Ubuntu 18.10.
In order to remove blank lines select the and remove by clicking on "-" in the Import Layout. Get here by Preferences > Editor > Code Style > Java > Imports

IntelliJ intellisense never suggest java.utils.Map [duplicate]

When I input List in Intellij, it doesn't automatically provide a prompt for importing java.util. I have to import java.util.List manually.
When I write java.util, it doesn't prompt to add List, but instead ArrayList.
Please check File | Settings | Editor | General | Auto Import | Exclude from Import and Completion. If "java.util.List" is there, remove it.
in my case, suddenly nothing from java.* was recognized.
tried setting different JDK's in File->ProjectStructure, then File->Invalidate Caches/Restart made it work again!

How to optimize imports automatically after each save in IntelliJ IDEA

I want to learn how can I automatically optimize imports after each save as we do Eclipse(save actions).
IntelliJ IDEA offers an option to Optimize imports on the fly in Settings | Editor | General | Auto Import and Optimize imports option in the Commit Project dialog.
The mentioned answer works, but there is also the Intellij "save actions" plugin available from the JetBrains plugin repository that does that (as well as other things): Intellij Save Actions Plugin.
Installation
File > Settings > Plugins > Browse repositories... > Search 'Save Actions' > Category 'Code tools'
Disclaimer
I'm the plugin developer
First step:
CTRL + SHIFT + A or CMD + SHIFT + A (for mac)
Second step:
Search Optimize imports
Third step:
Switch ON the option
In version 'Ultimate 2016.2' it is:
File > Other Settings > Default Settings > Auto Import > Optimize imports on the fly