简体   繁体   中英

How do I jump to the method that will be run in Intellij-IDEA?

Is there a keyboard shortcut I can use to jump to the method that would get run if I clicked the run button?

在此处输入图片说明

In this case, how can I jump my keyboard cursor to JustATest.testName() ?

You can jump to a specific method or field by adding a pound character (#) when you do a class search.

Depending on your keyboard setup, a class search is done with Command + N or Ctrl + N .

So, you'd want to type in the pop-up dialog TestClassTest#testMethod , and it will take your cursor straight to it. There might be a bit of shakiness with split panes, but for the most part, this is a simple solution that works in the general case.

The other way involves placing a bookmark on that line of code, and recalling it either through the Favorites bar or through the provided shortcuts.

Outside of that, you don't have many other options. IntelliJ wouldn't be able to divine that this method will for sure be run, since any manner of exceptions could occur before it gets to that method. At that point, you're left with just breakpoints in your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM