Alt+Enter not accepting IntelliJ suggestions
Asked Answered
C

0

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.

Cosmography answered 21/1, 2015 at 2:52 Comment(6)
Option+enter (without fn) works on osx installations of IntelliJ. Maybe it will work on your version running Bootcamp?Prosthetics
Danny's suggestion worked for me, also running Idea 14 bootcamped on a MBP (Windows 8.1, however).Perloff
@Danny, your solution of pressing option+enter (without fn) worked on my system. I have updated my original post to describe your solution.Cosmography
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 :)Kort
As an aid, you can refer to the key mapping for OSX jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard_Mac.pdfKort
@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 ?Gauntlett

© 2022 - 2024 — McMap. All rights reserved.