Eclipse/Java code completion not working

2019-01-01 09:35发布

I've downloaded, unzipped and setup Eclipse 3.4.2 with some plugins (noteable, EPIC, Clearcase, QuantumDB, MisterQ).

Now I find when I'm editing Java projects the code completion is not working. If I type String. and press ctrl+space a popup shows "No Default Proposals" and the status bar at the bottom shows "No completions available".

Any ideas?

标签: java eclipse ide
19条回答
春风洒进眼中
2楼-- · 2019-01-01 10:05

None of these worked for me.

I was experiencing this issue in only once particular class. What finally worked for me was to delete the offending class and recreate it. Problem solved... mystery not so much!

查看更多
几人难应
3楼-- · 2019-01-01 10:05

Once you have you configuration checked and completion is still not working:

  • make sure you have the right directory structure.

Do you see the right icon beside the file?:

enter image description here

It will tell you how the file will be treated by Eclipse:

enter image description here

I am posting this answer as I had that story with with Maven webapp artifact. By default Maven-WebApp does not create folder for sources and I put my Java into resources, wondering for 5 minutes what was going on... :)

查看更多
还给你的自由
4楼-- · 2019-01-01 10:07

Just in case anyone got to a desperate point where nothing works... It happened to us that the content assist somehow shrunk so no suggestion was shown, just the "Press Ctrl+Space for non-Java..." could be seen. So, it was just a matter of dragging the corner of the content assist to enlarge the pop-up.

I know, embarrassing. Hope it helps.

Note: this was an Ubuntu server with Xfce4 using Eclipse Oxygen.

查看更多
笑指拈花
5楼-- · 2019-01-01 10:10

Try restoring the default options in 'Windows > Preferences > Java > Editor > Content Assist > Advanced'

An example of the kind of data you see in this preference screen, however not necessarily what you currently have.

eclipse content assist setting

(From Vadim in this blog post " Content Assist Duplicates in Eclipse (Mylyn)":
if have duplicate Mylyn entries, uncheck the duplicate entries that do not contain "(Mylyn)" in their name)

The Eclipse help page defines the default list to restore:

Select the proposal kinds contained in the 'default' content assist list:

  • Other Java Proposals,
  • SWT Template Proposals,
  • Template Proposals,
  • Type Proposals
查看更多
浮光初槿花落
6楼-- · 2019-01-01 10:10

I had this problem and like @Marc, only on a particular class. I discovered that I needed to designate Open With = Java Editor. As a Eclipse newbie I hadn't even realized that I was just using a plain editor.

In the package explorer, right-click the file and chose "Open With".

查看更多
十年一品温如言
7楼-- · 2019-01-01 10:11

For those running Xfce + having IBus plugin activated, there might be keyboard shortcut conflict.

See more info on my blog: http://peter-butkovic.blogspot.de/2013/05/keyboard-shortcut-ctrlspace-caught-in.html

UPDATE:

as suggested by @nhahtdh's comment, adding the some more info to answer directly: IBus plugin in Xfce uses by default Ctrl+Space shortcut for keyboard layout switching. To change it, go to: Options and change it to whatever else you prefer.

查看更多
登录 后发表回答