63

A feature in Eclipse that I really miss is how you can auto-complete method parameters with currently in-scope variables. This feature will, with a single key combo (ctrl+space) fill in all method parameters. As long as my variables were named similarly to the method parameters, I never had a problem with this auto-complete. Is there a plugin or a native way to accomplish this in Intellij?

5 Answers 5

81

You might already know that IntelliJ IDEA has the CTRL+P shortcut (Windows) and CMD+P (OX X) that brings up a brief description of which parameters are passed to the method. It's very handy and saves a lot of time that otherwise would have been spent looking up the method declaration.

Sign up to request clarification or add additional context in comments.

5 Comments

Thank you for this - I'd been searching for that feature, I knew it must exist somewhere! IntelliJ forever! :)
(Cmd-P under OS X). It would be much easier to discover/remember if it was Ctrl-Shift-space or such, even if it needed to be pressed twice.
opens Print dialog for me.
You can also configure intellij, so that it will show this info automatically when you trigger auto completion: jetbrains.com/help/idea/2016.2/…
@boltup_im_coding usually (but not always) cmd commands from mac are control commands on Linux and windows. For the most part, windows and Linux commands mirror each other since you're usually using the same keyboard. If it isn't the case here, just go to settings and then keymap and search for the name of the feature you need a shortcut for.
40

IntelliJ IDEA 9 now supports what they call "super completion" which matches the behavior you are looking for and is available through their early access program.

alt text
(source: jetbrains.com)

IntelliJ IDEA 8 does not allow you to autocomplete more than one parameter at a time. You are forced to use Control-Shift-Space once for each parameter.

4 Comments

I type faster than IntelliJ's auto-complete most of the time, so this "super completion", while I'm giddy that it exists, is more like "tolerable completion"! "super completion" should populate the dag-nabbed parameters when you auto-complete the method name the way it does in NetBeans. Regardless, six years later, thanks for the tip @AlexB!
I can't find a "super completion" in IntelliJ IDEA 2016.1. On Windows, Ctrl-Shift-Space is mapped to "SmartType" completion, which doesn't complete the parameters. I agree, this is one of the features of Eclipse that I'm very much missing in IntelliJ.
OMG, so lame... On a method with ten overloads this is lame.
I cant find this feature on ij ultimate 2018.3. I have been looking for parameter completion or hints for a along time.
19

Control-Shift-Space (and the completion is based on type, not name)

For more goodness: Help -> Default Keymap Reference

1 Comment

sorry I wasn't clear - ctrl+shift+space only shows all parameters. I can then use tab to fill in the next one, and repeat this process, which is better than nothing, but still doesn't fill in all parameters at once.
2

There is also an IntelliJ plugin called 'kotlin-fill-class' that will fill in some default values automagically. Tested the latest snapshot version of the plugin with IntelliJ 2019.1 and it appears to be working.

1 Comment

Confirmed to work in 2019.2 using context actions (click on lightbulb or alt+enter).
2

from this post: https://stackoverflow.com/a/55160515/405749:

The plugin https://plugins.jetbrains.com/plugin/8638-auto-filling-java-call-arguments at least will provide a smart fix to do it when pressing alt+enter.

I have not found a away to do this completely automatically the way it works in eclipse.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.