eclipse 在 IntelliJ IDEA 中突出显示异常抛出器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7773670/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Highlight exception throwers in IntelliJ IDEA
提问by TDJoe
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.
我最近从 Eclipse 转移到 IntelliJ IDEA,但我缺少一个功能。在 Eclipse 中,当您将插入符号放在已检查的异常上时,在 throws 声明或 catch 块中,它会突出显示哪个方法/构造函数调用会引发该异常。
Is there any way to do this in IntelliJ IDEA (Community edition)?
有没有办法在 IntelliJ IDEA(社区版)中做到这一点?
回答by CrazyCoder
Place the caret on the catch
keyword and press Ctrl+Shift+F7.
将插入符号放在catch
关键字上并按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
| Highlight Usages in File
)。如果您使用不同的键盘映射并且上述快捷方式不起作用,请使用Help
| Find Action
搜索此操作并查看其键盘快捷键:
If you want it to work automatically, enable Settings
| Editor
| Highlight usages of element at caret
.
如果您希望它自动工作,请启用Settings
| Editor
| Highlight usages of element at caret
.
The same works on try
and throws
keywords with a choice of exceptions to highlight.
同样适用于try
和throws
关键字,可选择突出显示的例外。
Here is a screenshot from IntelliJ IDEA Tip of the Day:
这是 IntelliJ IDEA 今日提示的截图:
Note that there is no way to highlight it by particular exception class until you select this class from the list of suggestions:
请注意,在您从建议列表中选择此类之前,无法按特定异常类突出显示它: