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

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?

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.

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.
(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.

Control-Shift-Space (and the completion is based on type, not name)
For more goodness: Help -> Default Keymap Reference

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.

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 as it works in eclipse.

Related

Scala IDE doesn't show documentation during autocomplete hints

I can't see any documentation when I press "Ctrl + space" to see all the available functions.
For instance, in a Java class I can see the javadoc associated with each method:
But when I try to view the same information in a Scala worksheet, I can't see anything:
However, if I make a hover with my mouse over the method once it has been written I can see the documentation:
This behaviour is very annoying. Does anyone know how to do it in scalaIDE? Do I need to configure anything?
Perhaps you are using a non built-in compiler. In my case I was using as an installed compiler scala-2.12.0-M5.
If that is the case, try using a built-in one.
See also my last comment to the previous answer.
The new version should have the scaladoc integration working. Can you check if the Scala->Run Setup Diagonostics window and see if the two JDT options are checked?
ScalaIDE

Eclipse equivalent of CTRL-K in Netbeans

Netbeans has a nifty shortcut completion, I use while I type. It works in comments, in strings. Pretty much places where regular completion is useless. It basically autocompletes using the editor scope (in other words, whatever word matches closes to the point you are typing). Is there something similar in Eclipse ? I am making a transition due to lack of mybatis/mylyn support in netbeans. You can read more about it here https://blogs.oracle.com/chengfang/entry/why_am_i_using_netbeans .
It's called Word Completion. The key binding may vary; Ctrl/Cmd+Shift+L to find out.
CTRL+Space will show and sometimes autocomplete (depends on the settings you choose) methods names, variables and etc.
You can read more about specific settings and further fine tuning here.

IntelliJ IDEA scala type info

The Eclipse scala plugin has a very nice info. One can hover over pretty much anything be it a function definition, val, var, function call etc and get type info. This is immensely useful to me to ensure type compatibility especially when I am trying new things out.
Is there a similar feature in IntelliJ Idea 12.1 (the latest version as of this comment)?
The closest thing I could find was the type info setting. The default key binding did not even work for me on Mac OS 10.7.5. Even after tweaking, it does not work as universally as it does in Eclipse which shows a type for pretty much everything. Has any one managed to get this to work? My ideal setting would be type info on hover just like in the Eclipse.
I have heard great things about the IntelliJ IDE for Scala but so far the Eclipse Scala plugin wins hands down.
To enable on mouse hover type information go to Settings->Scala and select the "Show type info on mouse motion with delay" checkbox.
Type Info is great in IntelliJ; you have to press the key shortcut to see the type of a given variable or function.
If I recall correctly, there's a conflict between Type Info's key shortcut and something else in IntelliJ. If you go to Settings -> Keymap -> Plug-ins -> Scala -> Type Info, double-click it, you'll see the conflicts. I changed mine to Option ⌘ =. (see this answer for more tips if it still doesn't work)
Another shortcut I use quite a lot to quickly look up a definition is ⌘ shift I.
Not exactly what you're looking for but close enough - you can press alt + '=' when the cursor inside the function name, val name etc., and you will get popup with the type.
Intellij IDEA 14 (OSX) has this option in the Preferences -> Languages and Frameworks -> Scala Compile Server menu option.
Ensure that the Show type info on mouse motion with delay option is ticked.
I'm using Idea 13.0.2 with scala plugin 0.30.387 -- there is an option to display type info on hover just like eclipse. To turn it on, see
Preferences -> Scala

How to remember the choice of the run type in Eclipse?

Each time I try to run my Scala program in Eclipse it asks me whether it is Scala or Java. I select Scala, it runs, then I try to run it again, and Eclipse again asks me... this is tiresome.
How to make my choice stick, so I would be asked once or even not at all (extension should be recognized, I think)?
Update
See Luigi answer -- I am NOT asking about key assignment. I am asking about remembering my choice of the type of the file when running it. So it has nothing to do with editing the keyboard (actually I don't use any keyboard shortcut to run app).
Check the Launching Preference Page's "Launch Operation" setting and make sure you change it from the default to always launch the previously launched applicattion (or choose it from the Run/Debug button's drop-down menu).
Some parts of the Scala IDE are based on JDT - the Java Development Tools. This means that eclipse is sometimes unable to distinguish between a Scala and a Java application.
Some time ago this problem was discussed on the mailing lists. See the discussion there for some suggestions on how to avoid the upcoming frame.

Getting method help, while using Eclipse Pydev

I wonder, using Eclipse's PyDev plugin, how come documentation does not always show up?
Compared with
Is there a way to set Eclipse to "always show modules available along with the help attached"?
The problem is that depending on each context, the PyDev type inference engine may know or not what you're talking about... In the first situation it knows you're dealing with a string and thus can show you things properly. In the second, word is probably some parameter, so, it can't really find swapcase properly -- although it should work if you did an assert isinstance(word, str).