有没有办法在 IntelliJ IDEA 编辑器中只查看类的一个方法并隐藏其他所有内容,和/或在该 View 和常规 View 之间切换。
请注意,我不希望折叠/折叠其他方法,这当然是一种尽量减少在大文件中迷失方向的方法。 我正在寻找一种方法来仅查看我在类中处理的特定方法。
e.g. If there is a legacy code where an existing class has 10 long methods (each ~50 lines long), and I'm working on one of them and don't wish to be lost in the 500 lines of code and need to focus on a single method thereby narrowing my view to 50 lines of code.
我确实记得以前的几个版本说这是可能的,但我现在找不到那个设置。
最佳答案
在 IntelliJ IDEA 2019.3.3(社区版)中,有一个折叠选项“折叠选择”,甚至可以隐藏签名。
- 选择/突出显示您要关注的方法上方的代码
- 右键单击 > 折叠 > 折叠选择。快捷键 = cmd + .
它可能在早期版本中,但我没有检查过。
关于java - IntelliJ - 在包含许多方法的类中查看*单个*方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53999259/