For me it was because I did not have a folder marked as Source Root (it appears in blue).
To fix, right click your root source directory -> Mark As -> Source Root.
Answer from Loaf on Stack OverflowI tried everything. It was working like the first day I downloaded IntelliJ and then something happened where it stopped auto-completing. I looked up the issue, went into Preferences(Macbook) -> General -> Code Completion -> and checked and unchecked everything which looked like it could fix my problem.
Nothing worked, autocomplete only happens for some random words which are completely unrelated to the program I'm writing. It doesn't get the most obvious auto completes.
So I deleted IntelliJ and redownloaded. Nope. I deleted IntelliJ and all the files that came with it. Nope. (Though I may have done something wrong here, for some reason the code on InteliJ that I wrote came back, so I didn't delete it fully somehow. I gave up and started working on a project, but it's getting annoying without auto-complete. I don't wanna try deleting everything again so I don't have to redo all the files and everything. Heeeeeelp.
TLDR: Tried going Preferences -> General -> Code Completion, nothing worked, tried deleting reinstalling, didn't work. Help please, thank you so much in advance.
Autcomplete not working (anymore) on Intellij 2022.3
IntelliJ AutoCompletion Not Working
java - Why doesn't IntelliJ code autocomplete work? - Stack Overflow
Autocomplete is not showing in IntelliJ IDEA for Ollama
For me it was because I did not have a folder marked as Source Root (it appears in blue).
To fix, right click your root source directory -> Mark As -> Source Root.
Check to see if you accidentally turned on Power Save (File/Power Save Mode) I myself just discovered that File/Power Save Mode does turn it off. I was having the same problem and must have accidentally set Power Save Mode to on.
I tried everything. It was working like the first day I downloaded IntelliJ and then something happened where it stopped auto-completing. I looked up the issue, went into Preferences(Macbook) -> General -> Code Completion -> and checked and unchecked everything which looked like it could fix my problem.
Nothing worked, autocomplete only happens for some random words which are completely unrelated to the program I'm writing. It doesn't get the most obvious auto completes.
So I deleted IntelliJ and redownloaded. Nope. I deleted IntelliJ and all the files that came with it. Nope. (Though I may have done something wrong here, for some reason the code on InteliJ that I wrote came back, so I didn't delete it fully somehow. I gave up and started working on a project, but it's getting annoying without auto-complete. I don't wanna try deleting everything again so I don't have to redo all the files and everything. Heeeeeelp.
TLDR: Tried going Preferences -> General -> Code Completion, nothing worked, tried deleting reinstalling, didn't work. For example, it doesn't even finish any part of System.out.println or charAt(). Help please, thank you so much in advance. . P.S. I’m cross posting this on IntelliJ idea subreddit but no replies and for some reason the post was downvoted, so I’m posting here.
Several possible reasons:
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.
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.
Make sure the JDK for your project is set up correctly in the File | Project Structure window.
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.
External libraries that contain methods that you want to appear in the completion suggestions list are not added as dependencies or global libraries.
I had the same issue.
In my case, MacOS had mapped Ctrl + Space to "Select the previous input source" (in System Settings > Keyboard > Keyboard Shortcuts > Input Sources). Switching this off solved my issue.
Happy coding!