Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

intellij shortcut for creating method stub

I've recently switched over to intellij for scala development.

I'm having trouble finding the following shortcut:

In eclipse, I could type a method call e.g.

method("hello", 1)

and press <command>1 to have eclipse popup a suggestion to let me create a method stub.

Is there such a shortcut in intellij?

like image 751
Dzhu Avatar asked Jan 27 '12 02:01

Dzhu


People also ask

What is Ctrl K in IntelliJ?

In Eclipse, if the cursor is over a word and you press Ctrl + K you will jump to the next occurrence of that word in the file.

What is Ctrl Shift O in IntelliJ?

In Eclipse, you press CTRL + SHIFT + O “Organize Imports” to import packages automatically. For IntelliJ IDEA, if you press CTRL + ALT + O “Optimize Imports”, it just removes some unused imports, never imports any package.

What does Ctrl Shift F do in IntelliJ?

ctrl+shift+f searching in some last used directory instead of entire project Follow. Hello, In past IntelliJ versions, ctrl+shift+f would search the entire project (no matter whether you had at some point used "find in path").


2 Answers

Use Alt+Enter (Show Intention Actions in Settings | Keymap).

Verified, works fine in IDEA 11.0.1 with the current Scala plug-in: create method

like image 178
CrazyCoder Avatar answered Sep 23 '22 03:09

CrazyCoder


  • Activate Type aware highlighting (See the [T] symbol in the image) and
  • Set Highlighting level to Inspections

Then it is possible to use alt + enter (similar to Ctrl+1 in Eclipse) to show menu, which has create method option.

enter image description here

Why isn't it enabled by default?

The feature is in beta (or maybe in alpha) and sometimes may report "false errors" in regular code. Usually, such "errors" "found" only in a truly complex code, and, normally, everything works just fine.

Scala plugin doesn't rely on compiler to analyze code. We're implementing our own model of the language, and sometimes it's challenging, especially when it comes to Scala's type system and type inference (to size up the problem, you may try to formally "infer" a type of "foo".map(_ + 1) expression by hand).

like image 38
Cloudanger Avatar answered Sep 22 '22 03:09

Cloudanger