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

查看:26
本文介绍了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?

谢谢!

推荐答案

Version >= 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.

(我不确定静态导入如何与指定包一起工作,因为我从未尝试过,但我不明白为什么它不会.指定一个超级包并勾选带子包" 选项可能更有趣.)

(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天全站免登陆