完成时限制 IntelliJ IDEA 导入建议 [英] Limiting IntelliJ IDEA import suggestions on completion
问题描述
当我输入需要导入的类的名称时,IntelliJ 会亲切地弹出一个建议列表.然而,大多数情况下,这些建议是我永远不想导入的东西,尤其是偶然的——比如 java.awt.*
.
When I type the name of a class which will need to be imported, IntelliJ lovingly pops up with a list of suggestions. However, most of the time those suggestions are things I'd never want to import, especially by accident -- like java.awt.*
.
有没有办法防止我永远不会导入的包出现在完成列表中?
Is there a way to prevent the packages I'll never import from appearing in the completion list?
我已经搜索了选项,但没有找到任何东西.
I've scoured the options but I haven't found anything.
推荐答案
取决于 IDEA 版本:是的.
Depending on the IDEA version: Yes.
在 7.0.5 中使用菜单 File ->设置
选择Code Completion
,然后选择Exclude from Import and Completion
并添加您不想在建议中包含的包或类.
In 7.0.5 use menu File -> Settings
choose Code Completion
and then Exclude from Import and Completion
and add the package or class that you don't want to have in your suggestions.
在版本 8 和版本 9 中使用菜单 File ->设置
在搜索框中输入自动导入",然后使用那里的从导入和完成中排除
框.
In version 8 and version 9 use menu File -> Settings
type "Auto import" into the search box and use the Exclude from Import and Completion
box there.
在版本 9 中,您还可以选择直接从导入建议上下文菜单中将类和包添加到排除列表:
In version 9 you also have the option of adding Classes and Packages to the exclude-list directly from the import suggestions context-menu:
这篇关于完成时限制 IntelliJ IDEA 导入建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!