在 IntelliJ IDEA 中突出显示异常抛出器

我最近从 Eclipse 转移到了 IntelliJ IDEA,我缺少了一个特性。在 Eclipse 中,当您将插入符号放在选中的异常上时,在 throw 声明或 catch 块中,它将突出显示抛出该异常的方法/构造函数调用。

在 IntelliJ IDEA (社区版)中有什么方法可以做到这一点吗?

16254 次浏览

Place the caret on the catch keyword and press Ctrl+Shift+F7.

(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:

Find Action

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:

exceptions highlighted

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

exceptions to highlight