How do I use IntelliJ to auto-complete method parameters?

54,343

Solution 1

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.

Solution 2

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.

Solution 3

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

For more goodness: Help -> Default Keymap Reference

Solution 4

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.

Share:
54,343
Joschi
Author by

Joschi

Updated on July 09, 2022

Comments

  • Joschi
    Joschi almost 2 years

    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?

  • Joschi
    Joschi almost 16 years
    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.
  • scubbo
    scubbo over 10 years
    Thank you for this - I'd been searching for that feature, I knew it must exist somewhere! IntelliJ forever! :)
  • Brent Faust
    Brent Faust about 10 years
    (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.
  • coding_idiot
    coding_idiot about 10 years
    opens Print dialog for me.
  • inanutshellus
    inanutshellus almost 10 years
    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!
  • rdguam
    rdguam about 8 years
    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.
  • sjngm
    sjngm almost 7 years
    OMG, so lame... On a method with ten overloads this is lame.
  • Gellweiler
    Gellweiler about 6 years
    You can also configure intellij, so that it will show this info automatically when you trigger auto completion: jetbrains.com/help/idea/2016.2/…
  • John Little
    John Little about 5 years
    I cant find this feature on ij ultimate 2018.3. I have been looking for parameter completion or hints for a along time.
  • ThinkDigital
    ThinkDigital almost 5 years
    @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.
  • Marco Eckstein
    Marco Eckstein over 4 years
    Confirmed to work in 2019.2 using context actions (click on lightbulb or alt+enter).