Maor agai
Maor agai

Reputation: 331

Why doesn't IntelliJ code autocomplete work?

When I try to use the code autocomplete of IntelliJ by using ctrl+space it doesn't work.

What do I need to do?

For example, in this code I want to use the add method of List and it doesn't give me the option to.

enter image description here

Upvotes: 5

Views: 6842

Answers (1)

Koyasha
Koyasha

Reputation: 6857

Several possible reasons:

  1. Your file doesn't reside in a content root and is not bound to a build path, so it doesn't get the required class definitions and resources needed for code completion. To fix, right click your root source directory -> Mark Directory As -> Sources Root.

  2. Check to see if you accidentally turned on the Power Save mode (File | Power Save Mode). Turning it on minimizes power consumption of your laptop by eliminating the background operations, including error highlighting, on-the-fly inspections, and code completion. Turn it off.

  3. Make sure the JDK for your project is set up correctly in the File | Project Structure window.

  4. A file containing classes and methods that you want to appear in completion suggestions list is marked as a plain text file. To fix, right-click on the file -> Mark as Java class.

  5. External libraries that contain methods that you want to appear in the completion suggestions list are not added as dependencies or global libraries.

Upvotes: 7

Related Questions