本文介绍了突出显示IntelliJ IDEA中的异常投掷者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从Eclipse转移到了IntelliJ IDEA,而且我还缺少一个功能。在Eclipse中,当您将插入符号放置在检查异常时,在throws声明或catch块中,它会突出显示哪个方法/构造函数调用引发该异常。



在IntelliJ IDEA(社区版)中有什么办法吗?

解决方案

将插入符号放在 catch 关键字上,然后按 + + 。



查找 | 突出显示文件中的使用)。如果您使用不同的键盘映射,并且上述快捷方式不起作用,请使用帮助 | 查找动作以搜索此操作,并查看其键盘快捷方式:





如果要使其自动工作,请启用设置 | 编辑器 | 突出显示元素在脱字符下的使用



同样的作品在 try throws 关键字可以选择异常来突出显示。



这是IntelliJ IDEA提示的截图当天:





请注意,除非您从建议列表中选择此类别,否则无法突出显示特殊异常类:




I recently moved from Eclipse to IntelliJ IDEA, and there is a feature that I'm missing. In Eclipse, when you placed the caret on a checked exception, in throws declaration or catch block, it would highlight which method/constructor calls throw that exception.

Is there any way to do this in IntelliJ IDEA (Community edition)?

解决方案

Place the caret on the catch keyword and press ++.

(Find | Highlight Usages in File). If you are using different keymap and the above shortcut doesn't work, use Help | Find Action to search for this action and see its keyboard shortcut:

If you want it to work automatically, enable Settings | Editor | Highlight usages of element at caret.

The same works on try and throws keywords with a choice of exceptions to highlight.

Here is a screenshot from IntelliJ IDEA Tip of the Day:

Note that there is no way to highlight it by particular exception class until you select this class from the list of suggestions:

这篇关于突出显示IntelliJ IDEA中的异常投掷者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 08:27