ChatGPT解决这个技术问题 Extra ChatGPT

What is the shortcut in IntelliJ IDEA to find method / functions?

I know that Ctrl + N is to find classes and it is very useful. But what about methods?

It is similar, but it is not exactly the same function. (?)
For me it is Alt-Cmd-O, Select Navigate->Symbol menu item. Next to it you can see your shortcut.

M
Matthias M

ctrl + F12 (cmd + F12 on macOS) will show all members of the current class in a popup window and let you pick up one. It works exactly like the ctrl + o shortcut in eclipse, much faster than ctrl + alt + shift + n


Cmnd f12 on mac. I think this is a better answer.
Cmnd + ALT + O is also very useful on macs, to find symbols.
What's the name of action to show all members of the current class?
In fact in Eclipse this is Ctrl+O (Quick Outline). Ctrl+Shift+O is for Organize imports.
@sealskej it's called "File Structure" on the keymap setting.
P
Paul Verest

Windows : ^ ctrl + F12

MacOS : ⌘ cmd + F12

Above commands will show the functions/methods in the current class.

Press ⇧ SHIFT TWO times if you want to search both class and method in the whole project.


If you type "sudo grep something /" you can also find anything, on your whole computer :)
@olafure ,yes you can. "sudo grep something /" will search in whole computer and give lot of unnecessary results also will take lot of extra time. So, it's better to search something in IDE only.
I believe that's his point... When looking for methods using the option that will even find text results in files outside of the project is a bit heavy-handed.
While this answer is technically correct, it's what I've been trying to avoid since I don't want to search multiple files which might have the same method name. the Ctrl+F12 method below with like 3x as many upvotes is what should be marked as the correct answer...
what is difference between this and Ctrl+Alt+Shift+N ?
g
gvlasov

Ctrl + Alt + Shift + N allows you to search for symbols, including methods.

The primary advantage of this more complicated keybinding is that is searches in all files, not just the current file as Ctrl + F12 does.

(And as always, for Mac you substitute Cmd for Ctrl for these keybindings.)


Thank you very much! And how can I find this option on menus?
I found it! It is under Go To menu. Easy!
Does not work for me on mac. Although CMD+ F12 works. Thanks
Ctrl + F12 worked nice for me. Intelli IDEA J 2018.2
J
Joshua Pinter

Android Studio on Mac

Command + Option + O

Opens up the Symbol lookup that you can jump to most of the methods/functions in your currently opened document.


The results displayed using this key combination aren't restricted to the currently open document. For that, cmnd+f12 is what you want (per the answer by Daniel Dang and comment by Thomas).
For complete clarity, what exactly is the definition of "Symbol" in terms of Android Studio?
@ImpalaTamer Good question. I use it to jump to methods, functions and definitions mostly but it looks like it could bring up more than that.
n
nmfzone

Intellij IDEA 2017.3.4 - 2018.2 (Ultimate) on OSX

CMD + fn + F12

will show all members of the current class in a popup window, then you can search method in that class.

BUT, this answer is depends on your Keyboard setting. If your keyboard setting in

System Preferences > Keyboard > Use all F1, F2, etc. keys as standard function keys

is selected, then the shortcut becomes

CMD + F12


I think this should be the correct reply as it gets you to the methods window only, where with further shortcuts we can also see inherited, anonymous and lambdas. Powerful and cool! Thanks
c
csvan

CTRL + F12 brings up the File Structure navigation menu, which lets you search for members of the currently open file.


J
Jack Chi

IntelliJ IDEA Version 12.13 Ultimate Edition:

Macs: command + option + shift + N or on Menu -> Navigate > Symbol ...


Did not work for me this option. Here in Mac is command + option + O
It depends on the keymap you choose in "Preference->Keymap" . it seems you choose the "Mac OS X 10.5+"
G
Geert

Slightly beside the actual question, but nonetheless useful: The Help menu of Intellij has an option 'Default Keymap reference', which opens a PDF with the complete mapping. (Ctrl+F12 is mentioned there)


T
Tushar

If you just want to look for methods:

On mac OS X 10.5+ binding, it is Alt + ⌘ + O

By Default XWin Key binding, it is Shift + Ctrl + Alt + N

You can also press double SHIFT then, you can search anything (not only method, but also class, files, and actions)


I've removed the tutorial URL. Please don't include the URLs that could be considered as spam.
M
Marv

It is worth adding that if you want to search for a method of a class, you can use a . (dot) between the class and method name inside of either the search everywhere or search symbols dialog. This even works with IDEAs usual search benefits. For example, you can search for LDT.now and LocalDateTime::now will pop up as a result. (As long as you are searching All Files and not just Project Files).

https://i.stack.imgur.com/W3hec.png


M
Misha Akopov

If you click on a method, you can do Ctrl + B to go to that method's declaration. Similar to F12 in MS Visual Studio.


M
Mwiza

To Find the actions build in the IDEA(reindent, create new, ...) you can use

CRTL+SHIFT+A

then type indent for example and ENTER.


f
flow2k

If I need navigate to method in currently opened class, I use this combination: ALT+7 (CMD+7 on Mac) to open structure view, and press two times (first time open, second time focus on view), type name of methods, select on of needed.


u
user1195796

Intellij v 13.1.4, OSX

The Open Symbol keyboard shortcut is command+shift+s


M
Mwiza

Ctrl + Shift + Alt+ 7 after selecting the method


M
Muhammad Hewedy

I tried SHIFT + SHIFT and ALT + CMD + O

But I think the most powerful and easy to use feature is find in all files CMD + SHIFT + F.

Choose regex and write .*partOfMethodName.*\( and it shows all places and can see the actual source code in place without going to that specific file.


G
Gustavo Passini

In the KDE IntelliJ keymap, the command is Ctrl + 0 (that's a zero).