首页 文章

禁用IntelliJ已加星标(包)导入?

提问于
浏览
180

我是一个迁移的Eclipse IDE用户,我正在学习IntelliJ IDEA 9 .

默认情况下,Eclipse IDE将不会使用星号导入,直到从同一个包导入99个类,因此几乎不会发生 .

但IntelliJ IDEA似乎太热衷于这样做了,我无法弄清楚如何禁用它 .

例如,在输入 JList 然后ALT ENTER进行自动导入后,将导入整个 javax.swing 包,而不仅仅是我指定的类 .

我尝试从自动完成中排除 javax.swing ,但这只会阻止建议任何Swing类,这会适得其反 .

3 回答

  • 58

    而且您还必须从“使用导入的类计数”文本框下方的"Packages to use import with *"列表框中删除包名称 . 我认为Swing和AWT默认存在 . 我还在导入javax.swing . 即使我将类计数设置为999也添加了 . 我使用减号按钮从框中删除Swing和Awt然后它工作 .

  • 274

    您可以在此处设置此设置 .

    IDEA 14 中,序列是:

    Settings > Editor > Code Style > Java > Imports > Class count to use import with '*'

    在较旧版本的IDEA中:

    Settings - > Java - > Code Style - > Imports - > Class count to use import with '*'

    无法禁用该功能 . 您需要将其设置为较高的值,例如99 .

    在2016.1.1版本中您还应删除 Packages to Use Import with '*' 下的行,例如 import javax.*;

  • 1

    IntelliJ IDEA:

    • 141516 EAP

    File > Settings... > Editor > Code Style > Java > Imports >在 General 区域为 Class count to use import with '*': / Names count to use static import with '*': 添加一个大数字

    File > Settings... > Editor > Code Style > Java > Imports > General > Class count to use import with '*'

    IntelliJ IDEA:

    • 1213

    File > Settings... > Code Style > Java > Imports >在 General 区域为 Class count to use import with '*': 添加一个大号
    File > Settings... > Code Style > Java > Imports > General > Class count to use import with '*'

    P.S . : Java 在路径中的 Code Style 之后 .

相关问题