How to automatically navigate to the current class

2019-01-30 09:28发布

问题:

I would like to have a keyboard shortcut in IntelliJ IDEA that has the following effect: the tree in the project tool window expands to show the currently open class (or file), and this class becomes selected in the tree.

Is this possible?

回答1:

Navigate (View in older versions)| Select In... (Alt+F1), Project View (Enter).

It's also possible to enable Autoscroll from Source option in the Project View so that current file is automatically selected.



回答2:

Right click on Project/Packages area > Autoscroll from Source

or

Left click on the wheel > Autoscroll from Source

There is also: Autoscroll to Source - the selected file from the tree view will be opened in the right side.



回答3:

Try Alt F1(Select Target dialogue) + Enter.



回答4:

Click at this icon on the top of tree-box.



回答5:

you can do this also using the upper dynamic menu that change for every opened file. just click twice on the last folder and the file will be on the same folder branch

also good for pycharm



回答6:

You can also make your own key combo to the "select in tree view" via prefs. I often do: shift + cmd + a and then just write select in.. and then press enter.