Why the intellij code autocomplete doesn't work?

Viewed 1851

When i try to use the code autocomplete of intellij by using ctrl+space it dosen't work. What i need to do? example: In this code i want to use the add method of List and it dosen't give me the option to.

enter image description here

1 Answers

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.

Related