Eclipse:代码完成中的黑名单类型 [英] Eclipse: Blacklist types from code completion

查看:84
本文介绍了Eclipse:代码完成中的黑名单类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如,我使用Google Collection的 com.google。 common.collect.Lists 类很常见。我会做的是键入列表,然后Ctrl-space并选择一个方法(如 newArrayList()),Eclipse将自动添加导入语句。但是一个令人讨厌的事情是,TestNG具有与不同的包名称 org.testng.v6.Lists 相同的类,通常我会错误地选择TestNG版本。 p>

有没有办法从代码完成的考虑中黑名单 org.testng.v6.Lists t导入错误?

解决方案

您可以设置类型过滤器来执行此操作。请参阅禁止内容帮助中的类型一节 here 获取更多信息。



以下是后代的屏幕截图:



打开首选项对话框,然后转到Java - >外观 - >类型过滤器:





点击添加...按钮:





现在应该出现在过滤器列表中:




Is there a way to blacklist certain types from consideration in Eclipse's code completion?

For example, I use Google Collection's com.google.common.collect.Lists class quite often. What I will do is type "Lists" then Ctrl-space and select a method (like newArrayList()) and Eclipse will add the import statements automatically. But one annoying thing is that TestNG has the same identical class with a different package name org.testng.v6.Lists and often I will select the TestNG version by mistake.

Is there a way to "blacklist" org.testng.v6.Lists from consideration in code completion so I don't import it by mistake?

解决方案

You can set up Type Filters to do this. See the section "Suppress types in content assist" here for more information.

Here are some screen shots for posterity:

Open the preferences dialog and go to Java -> Appearance -> Type Filters:

Click the "Add..." button:

Now it should appear in the Filter list:

这篇关于Eclipse:代码完成中的黑名单类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆