IntelliJ静态导入完成 [英] IntelliJ Static Import Completion

查看:1149
本文介绍了IntelliJ静态导入完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse中,我能够为静态导入自动完成注册一组类,例如Math。,Assert。,EasyMock。*

In Eclipse I was able to register a set of classes for static import auto-completion, e.g. Math., Assert., EasyMock.*

启用此功能后,我可以点击ctrl-space assertEquals,pow,createMock等。显示为有效的代码完成。

With this enabled I was able to hit ctrl-space assertEquals, pow, createMock etc. would appear as valid code completions.

我很难在IntelliJ中找到它,但我相信它必须存在。任何人都可以帮忙吗?

I'm struggling to find this in IntelliJ but am sure it must exist. Can anyone help?

谢谢!

推荐答案

版本> = 11 :



设置 - >代码风格 - > Java - >进口(标签)

设置 - >代码风格 - >导入

在窗格中间是使用'*'导入的包表。您可以在此处添加完全限定类名的条目,并勾选静态框;现在这个类中的所有静态方法都可用于自动完成。

In the middle of the pane is the "Packages to Use Import with '*'" table. You can add an entry here of a fully-qualified class name, and tick the static box; now all static methods in this class will be available for auto-completion.

(我不确定静态导入如何指定包,就像我一样从来没有尝试过,但我不明白为什么它不会。指定一个超级包并勾选with subpackages选项可能会更有趣。)

(I'm not sure how the static import works with specifying a package, as I've never tried it, but I don't see why it wouldn't. Specifying a super-package and ticking the "with subpackages" option could be even more interesting.)

这篇关于IntelliJ静态导入完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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