6

After I typed "@Test" (without the quotes) and then hit Enter, IntelliJ suggested adding the "import org.junit.Test;" statement by pressing Alt + Enter.

However, every time I tried to do this, IntelliJ presented me with a "Generate" menu instead of adding the suggested import statement.

In the past, I've successfully used Alt + Enter in IntelliJ 13 on my Windows 7 Professional workstation at work.

Currently, I am having the problem with Alt + Enter not working on a brand-new installation of IntelliJ 14 that I have running on Windows 7 Professional via Bootcamp on my MacBook Pro. I have left the Bootcamp keyboard settings at their defaults. So fn+option is equivalent to Alt, and works fine in other programs.

Therefore, fn + option(Alt) + enter should work in IntelliJ to accept a suggestion.

However, as described above, this is not the case on my system. Does anyone have any ideas for how to fix this?

UPDATE: @Danny provided the solution: On a MacBook Pro running IntelliJ IDEA 14 on Windows 7 via Bootcamp, press option + enter (without the fn) for the equivalent behavior of pressing Alt + Enter on traditional PCs.

This works to accept IntelliJ suggestions such as adding import statements to your code needed by dependencies.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Ted Finch
  • 61
  • 1
  • 4
  • 2
    Option+enter (without fn) works on osx installations of IntelliJ. Maybe it will work on your version running Bootcamp? – Danny Daglas Jan 21 '15 at 03:01
  • Danny's suggestion worked for me, also running Idea 14 bootcamped on a MBP (Windows 8.1, however). – Mic Jan 21 '15 at 03:08
  • @Danny, your solution of pressing option+enter (without fn) worked on my system. I have updated my original post to describe your solution. – Ted Finch Jan 21 '15 at 18:10
  • Yes, I run into similar issues when as I regularly switch back and forth between Windows OS, Ubuntu, and OSX. I have gotten used to trying one or the other until it works :( - wishing it was consistent behaviour in all environments/OS but that's another topic :) – blurfus Jan 21 '15 at 18:21
  • As an aid, you can refer to the key mapping for OSX https://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard_Mac.pdf – blurfus Jan 21 '15 at 20:29
  • @DannyDaglas - I am on win 7, 64 bit with Intellij Idea 2016.2.4. Alt enter has stopped working properly. It does not offer any suggestions when I want to create a test case in junit. Can you please advise how to fix this ? – MasterJoe Oct 16 '16 at 19:39

0 Answers0