60

The autocomplete of eclipse is not working now and I searched for hours but I couldn't find an answer to solve it. I haven't used it for long time then the first thing after opening it was to install SWT and windows builder even though I had swing installed. What I mean is, it is may possibly be because of some conflict caused by swt and swing(I read something about a conflict but I don't if this is possible).

Strange thing is it doesn't show anything when I press ctrl+space but when I go Edit-> Content Assist -> Default(it says Ctrl+Space nearby it), it shows things needed to be shown/works as desired.

public class Dsada {
    String sssss;
    public Dsada(){
        sss //pressing ctrl+space is not working,Edit->ContentAssist->Default works fine
    }
}

The solution is not to tick/untick some stuff under Windows->Preferences->...->Content Assist-> Advanced. I checked if "ctrl+space" is hijacked by some other thing which is not and checked keyboard language which is English(Those are suggested in mkyong).

I read something about a bug but I couldn't understand. I tried to delete eclipse and re-install again but I guess some settings just stayed in the machine so that it didn't work.

starball
  • 20,030
  • 7
  • 43
  • 238
smttsp
  • 4,011
  • 3
  • 33
  • 62
  • Please consider changing the accepted answer to the one made by Pete Kelley. I just found his answer to be exact in 2020. – D-Klotz Jul 30 '20 at 18:48
  • To really make the suggestions __*automatic*__ read the answers here: https://stackoverflow.com/questions/6202223/auto-code-completion-on-eclipse – aderchox Feb 09 '21 at 20:39
  • I found below link worked for me https://stackoverflow.com/questions/908489/eclipse-java-code-completion-not-working/908930 – user13729379 Sep 13 '21 at 17:41

14 Answers14

222

This is recurring for me. I'm using Eclipse 2019-03 in Windows 10. The steps below work for my case, and does not require a restart.

Window->Preferences->Java->Editor->Content Assist->Advanced

The following options are de-selected, and when I set them the autocomplete worked as before. No restart needed.

 1. Java Non-Type Proposals 
 2. Java Proposals 
 3. Java Type Proposals
 4. Java Proposals (Task-focused)

I don't know what's triggering this but it only happens after I've created a new project. Usually doesn't. It simply doesn't happen often enough for me to notice a pattern to follow up on more. Clearly this problem occurs with a variety of causes, so review the other answers to see if they match your case.

Pete Kelley
  • 3,713
  • 2
  • 16
  • 17
  • 12
    This worked for me. I noticed Eclipse changed the Content Assist for some reason after I loaded another workspace that didn't show the problem before. Maybe some settings got messed up while switching. –  Jul 10 '19 at 16:44
  • 1
    Not sure why It happened. Normally it works out of the box. The above steps actually worked. – VJEY Dec 13 '19 at 05:15
  • It worked for me when I **only** checked these ones: API Tools Proposals, Java Proposals, JAX-WS Proposals, JAXB Proposals, JPA Proposals, SWT Template Proposals, Template Proposals. – rodrigocfd Jan 21 '20 at 14:32
  • 1
    Same problem, same solution. Maybe it's caused by converting the workspace from older version. Anyway, your answer has saved me from re-creating the workspace from scratch. – 9ilsdx 9rvj 0lo Feb 17 '20 at 11:05
  • 3
    Guess what, Eclipse 2020-03 and this answer is still the solution. – Sven Mar 27 '20 at 10:15
  • besides, I needed to disable the main ContentAssist option for better experience, otherwise whenever I click ctrl+space, it asks me which assistant type I need, which is inconvenient – osama yaccoub Sep 09 '20 at 03:20
  • This worked for me too! I though I had broken it with lombook but this was the real issue. – Sam Oct 14 '20 at 03:19
  • It worked for me after restarting Eclipse – Salman Sep 16 '21 at 12:55
  • I'm using 2021-06 and sure enough the problem arose as soon as I created a second workspace. Nothing worked. Autocomplete definitively broken. – Liios Sep 20 '21 at 10:06
  • 2
    2021-06 - 'Restore defaults' disables most of these - I wonder whether that's the problem? – SteveR Oct 05 '21 at 09:47
  • 1
    Was having this issue with 2022-03 but this solution worked. – Anton Apr 12 '22 at 12:15
  • 2
    Eclipse 2022-09 same issue after opening workspace of 2022-03 and selected convert. This solution helped. – appsofteng Oct 25 '22 at 22:26
24

The hot key combination ctrl+space might be conflict with other settings in system if you are using windows.

Try modify this combination like alt+/, i always use this one since the first time i knew eclipse. It works well.

Hope it works for you.

Howard
  • 4,474
  • 6
  • 29
  • 42
  • It worked a bit. If there is only one possible word, then it completes, but if more it is not bringing the possible templates. – smttsp Feb 13 '14 at 16:23
  • 1
    That's weird. Actually, there are two places to be modified, `window -> preferences -> General -> Keys`, find `Content Assist`, modify the `Binding` to `Alt+/` if it wasn't, and find `Word Completion`, modify the `Binding` to `Alt+.` if it wasn't. Those two options sometimes conflict with system's. After doing so, try with `Alt+/` or `Alt+.`. – Howard Feb 14 '14 at 00:38
  • I did that way but it worked as I said. I tried Ctrl+Shift+Space as well, the result is same. I couldnt think of any solution for that but do you think it is possible that if I completely delete everything about eclipse it will work? Or there is a bigger problem than that? – smttsp Feb 15 '14 at 12:16
  • I deleted everything related to eclipse, and re-unzip it. Then did what you have proposed. Now, I'm not able to use `ctrl+space` (while changing key, it is accepting ctrl+space) but `ctrl+shift+space` works fine :) at least better than not working at all. Still, I wish, I could be able to use `ctrl+space` – smttsp Feb 15 '14 at 14:18
  • If you are using window OS, `ctrl+space` is the system default hotkey for changing `input method`. So that is the problem with eclipse itself, since `ctrl+space` is the default setting come up with eclipse. Anyway, changing it would be a good solution. And so far as i know, it was a common issue which i have no idea why eclipse team didn't change it. – Howard Feb 17 '14 at 06:18
  • If using Ubuntu check answer regarding ibus! – JohnyTex Jun 09 '15 at 14:15
  • Nb: please add JRE system library and server runtime in Java build path library. You can get proposals through this. I got the proposals once I add these to my Java build path select project→right click→properties→java build path→library→add library – Ṃųỻịgǻňạcểơửṩ Jan 25 '20 at 06:29
18

Window->Preferences->Java->Editor->Content Assist->Advanced

The following options have to be selected, then the autocomplete worked . No restart is required.

Java Proposals  (must be selected, not sure the follows)

Java Non-Type Proposals
Java Type Proposals
Java Proposals (Task-focused)
caot
  • 3,066
  • 35
  • 37
  • Works for me on Version 2021-03 (Oxygen.3?). Indeed where not selected by default. Thanks @caot! – Camille Jun 11 '21 at 11:02
10

I was facing the same issue. If you use OS X Eclipse Ctrl+Space shortcut can be interfering with OS X system's "Selecting previous input source" using Ctrl+Space shortcut as default.

It is necessary to edit System Preferencies/Keyboard/Shortcuts/Input Source and uncheck the "Selecting previous input source" or change the shortcut on something else. Eclipse should work after that even without restart.

Andrej Buday
  • 559
  • 5
  • 14
  • Thanks for the reminder of this classic. The funny thing was that it did work without addressing this for a couple of months. Then I had do this (macOS 11 Big Sur). – MiB Sep 02 '21 at 10:33
  • That was also in my case, macOS Monterey, Eclipse 03-2022, you have to switch off the Apple Shortcuts first! – basZero Jun 08 '22 at 11:07
  • In my case the latest macOS Update stole my shortcut... https://share.cleanshot.com/FbGBN5HF – Daniel Bleisteiner Jan 26 '23 at 14:18
6

I faced hot key problem with use Ctrl+Space. I tried to fix the issue first by Windows->Preferences->...->Content Assist-> Advanced and selected Select the proposal kinds contained in the 'default' content assist list:

  • Other Java Proposals,
  • List item
  • SWT Template Proposals
  • Template Proposals
  • Type Proposals

but didn't help.

Therefore, I tried another solution. There would be multiple languages on your computer which could be eating up your Ctrl command. To solve this Go to Control Panel -> Region and Language -> Keyboards and Languages (tab) and then Change Keyboards.

You’ll see a list of languages installed – remove any that you don’t want (click the language and then click the Remove button) until you only have the ones you want left. That fixed it for me, but you can also check the Advanced Key Settings tab to make sure that none of the keyboard short-cuts that are set include Ctrl-Space.

Once you’ve done that, Ctrl-Space should work nicely!!!!

Harleen
  • 773
  • 3
  • 15
  • 25
  • my mac was using this shortcut to switch the keyboard... you saved my day man, thanks ! – Digao Aug 29 '22 at 12:54
3

Go to Windows >> Preferences » Java » Editor » Content Assist. Then Check the Auto activation triggers for java, Add this in the text box .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

Jay Patel
  • 35
  • 2
2

I had the same Problem on Ubuntu 14.04. The problem for me was that ibus used Ctrl+Space as a shortcut. I solved it by starting the program ibus-setup and chaning the shortcut to something else than Ctrl+Space.

Guillermo
  • 764
  • 6
  • 15
1

Recently, I also faced this issue. When I install neon version eclipse. By (1) deleting respective class, (2) restoring defaults appearance and (3) restarting eclipse, solved the problem for me. Hope it will help someone.

smttsp
  • 4,011
  • 3
  • 33
  • 62
Abu Nayem
  • 101
  • 3
  • 11
0

Go to Preferences » Java » Editor » Content Assist » Advanced. Make sure Other Java Proposals is ticked/checked.

I checked windows has no conflict of ctrl+space (of eclipse autosuggestion) with windows.

This is mere configuration issue of eclipse. reinstallation would fix it.

Thanks.

Adeel Ilyas
  • 176
  • 1
  • 8
0

I select all the parameters in Preferences -> Java -> Editor -> Content Assist -> Advanced. It help me and resolve the my problem. Cltr+space work using this step.

0

Saving my work and restarting Eclipse solved this for me. I hadn't shut down Eclipse in a while, maybe weeks.

Shaun
  • 35
  • 7
0

I had the same problem (MacOS Monterey, Eclipse 06-2022). Turned out it works with pressed fn button.

vlad
  • 1
0

For Mac user, you can try : Preferences -> Java > Editor > Content Assist and then :

  • tick the field "Enable auto activation"
  • in the field Auto activation trigger for Java, you can input the text alphabet ".abcdefghijklmnopqrstuvwxyz"
0

Didn't work anymore after I upgraded to MacOS Ventura 13.3.1. Resetting content assist in Eclipse did not work until I removed the Ctrl-Space binding for Mac in Setting->Keyboard shortcuts->Input Sources.

Rob NL
  • 1