Shortcut to see method parameters, or placeholders?

When I finish typing a method name (for call), or maybe have added a few parameters, I want to see quickly all the parameters, maybe because I forgot the some of them, or to check I'm entering them in the correct order...

In Eclipse if I remember correctly it's possible
- Shortcut CTRL+space -> shows the parameters
- After finish the name, CTRL + space will add placeholders for all the method names and I can just start typing them and then go to the next with tab.

Currently I don't know how to do any of these in IntelliJ and I always have to hover the cursor over the method name (pressing CTRL).

I'm using IntelliJ for Scala development, also Android Studio (which is based on IntelliJ and Java). Both behave the same. Don't know if it's related with the programming language.

Thanks.

1
7 comments
Avatar
Permanently deleted user

Ctrl+P will show the list of parameters. The current parameter be will be in bold. You can use TAB and Shift+TAB to navigate between parameters. In the event of overloaded methods, all are shown. As you enter the parameters, any overloads that do not match are grayed out.There is a setting to indicate if you want the full signature shown or not. For example, for the String.subString method:

int beginIndex, int endIndex
vs
@NotNull String subString(int beginIndex, int endIndex)

In order to for the parameter names to show, the source or javadoc for the library needs to be attached to the project. To set the "full parameter" option, go to File > Settings > [IDE Settings] > Editor > Code Completion. The setting is in the "Parameter Info" section.You can also enable the parameters dialog to open automatically when entering a method call.

6

Perfect, thanks!

P.S. Actually, the CTRL + P shortcut would have been easy to find in the shortcut list CTRL + SHIFT + A - "Parameter Info". Don't know why I didn't think about that. But now I got other useful information :)

0

If I assign Ctrl+Space (Windows) to "Parameter Info" while it's also assigned to Code Completion (Basic), will that cause a contextual conflict somewhere?

I want to use Ctrl+Space while inside of a function call's parentheses in case I forget exactly what I need to pass there, and to me that functionality is effectively the same as hitting Ctrl+Space before typing the function call's parentheses (and they look almost identical anyway):

I realize that Ctrl+Space before typing the parentheses shows much more info than Parameter Info, but I can already Ctrl+click the function call if I need detailed info once I've typed the parentheses.

I tried assigning Ctrl+Space to Parameter Info as well, and it works, but I'm not sure if there's some contexts where the functionality of that and Basic Code Completion would collide detrimentally.

0

Hello,

Unfortunately this particular behaviour (when two these actions are assigned to one shortcut) was not tested, but it's excepted to have no issues. In case you face any, please feel free to file an issue in our bug tracker: https://youtrack.jetbrains.com/issues/IDEA

Thank you 

0

Are you aware of contexts where they would logically conflict?

0

Hello,

No, because the described scenario wasn't tested.

0

I don't know why people don't mention the name of the shortcut in Keymap when they mention the keyboard buttons to press (Cmd+P on Mac), because Ctrl+P on Mac doesn't do what Ctrl+P does on Windows for this shortcut.

The actual shortcut name is found in settings Keymap > Main Menu > View > Parameter Info.

The OS (operating system) and name of the keymap shortcut should be stated when providing an answer for keyboard shortcuts, as I've ended up going down winding paths or setting the wrong shortcut or have had to make additional comments or a new thread to figure out what people meant before.

Note that I'm posting this partially to have an easily searchable text in here for others using Mac that want to find this shortcut, as it's very valuable when the caret is in the middle of a function call and you want to quickly see or re-view the parameter list.

 

0

Please sign in to leave a comment.