Eclipse Java Content Assist not working
Asked Answered
N

14

21

The Content Assist in Eclipse 3.4 and 3.5 has stopped working for me. When I type in the first few characters of a class and hit CRTL-space then after a delay I get the following error message alt text http://locuslive.com/webdrive/JDTscreenshot.png

It does not matter what proposals I enable/disable, I will get this (or similar) message.

I have tried:

  • Changing the Xms/Xmx values

  • Starting Eclipse with -clean

  • Creating a new workspace and importing my projects

However none of these have worked.

I have seen some posts suggesting that other apps may be taking over the CRTL-space or otherwise interfering, however I have nothing aside from a fresh Eclipse running and the problem persists.

My problem is very similar to the one covered in this post albeit on a later version and on OSX 10.5.7.

Does anyone have any suggestions for how this might be resolved?

Thanks.

UPDATE: To anyone interested I've had the best results by using Eclipse 3.5 Classic (ie. doesn't include Mylyn). I've also used the settings specified in the bug reports linked to by VonC below.

Interestingly Classic doesn't come with some views eg. Snippets, but these are easy to drop in from another distro.

UPDATE 2: This problem actually persisted even with the latest versions of Eclipse (3.6 M1). It is caused by a large JAR file generated my Altova Mapforce to handle EDIFACT transformations in our application. It is reproducible by adding this JAR to the buildpath and no changes to Content Assist settings help. The bug (and JAR) can be seen at https://bugs.eclipse.org/bugs/show_bug.cgi?id=289057

Nickey answered 2/9, 2009 at 12:7 Comment(2)
May be related to bug 281871, see second part of my answer.Wroughtup
You can change your configuration to resolve this problem : https://mcmap.net/q/660058/-eclipse-warning-quot-problems-during-content-assist-quotTransect
W
19

the Mylyn FAQ does mention:

Why do I get an error message when using content assist?

If after invoking Content Assist you see an error message dialog that states:

 The extension took too long to return from the 'computeCompletionProposals()' operation

https://static.mcmap.net/file/mcmap/ZG-Ab5ovK1cpZRkQXVMsZ7BxXS2vbmb/images/0/0a/Mylyn-content-assist-timeout.gif

this is most likely due to something interrupting the proposal operation (e.g. garbage collection). Ignore it if it does not recur, increase Eclipse’s memory if it does (e.g via -Xmx384M command line argument). See bug 141457 for more details.

Note that Mylyn should only add a trivial amount of overhead to content assist computation, however, the standard content assist mechanism will not report timeouts of this sort (i.e. taking longer than 5s to compute proposals).
If the system that you are working on is so large that increasing memory does not reduce the timings to avoid the message, you could also consider disabling the Mylyn-specific content assist, as described above, but if doing so please comment on bug 141457.


You can find good eclipse settings in this SO answer.
Since you have already try increasing memory, you can leave a comment on the bug 141457.

This could be related to the bug 281871, only fixed in eclipse 3.5.1 and 3.6.

I see it now. The problem is that code assist starts to use the Java model if the index is not yet up to date.

You can either wait until the indexer is done or increase the timeout by setting the 'org.eclipse.jdt.ui.codeAssistTimeout' Java environment variable when starting Eclipse, e.g.

 -vmargs -Dorg.eclipse.jdt.ui.codeAssistTimeout=60000
Wroughtup answered 2/9, 2009 at 12:33 Comment(1)
Thanks. It does sound like bug 281871. I've added the codeAssistTimeout and it's all working. Now just need to decide whether to stay with Mylyn or EclipseClassic.Nickey
P
12

I´ve runned onto the same, Content Assist not working under Eclipse 3.7.2. Up to this version is pretty stable, tough I don´t know how come it never worked for me.

I haven´t had any error message nor tip on why it wasn´t working and took me a while to find the 'Java Proposals' option.

It is on Eclipse Preferences -> Java -> Editor -> Content Assist -> Advanced.

Make sure that Java Proposals is checked.

You don´t wan´t repeated Java suggestions. Don´t check Java Non-Type Proposal nor Java Type Proposals.

Purgatorial answered 12/6, 2012 at 13:1 Comment(0)
G
2

For me it works by doing prefrerences > general > keys > Restore Defaults

Dont know its crazy but thats what finally works after all the googling and trail following.

Regards, Manish

Gonzalez answered 27/5, 2010 at 21:28 Comment(2)
If you read the question you'll see that it was an Eclipse bug relating to large JAR files. This has now been fixed in the 3.6M6 release of Eclipse.Nickey
This fixed an issue I had with 3.7Timbre
G
1

Looks like your mylyn install may be broken try removing the mylyn plugin and see how you get on.

Grain answered 2/9, 2009 at 12:12 Comment(1)
Paul (and Daniel), thanks for the tip on Mylyn. I downloaded Eclipse 3.5 Classic that comes without Mylyn and this has made some difference. At least I can continue working now. Cheers.Nickey
N
1

When I had a similar problem, I simply uninstalled the Mylyn/Java integration. I don't use Mylyn, and although I know some people consider it to be the best thing since sliced bread, I've never found it to be anything other than a way to screw my name completion.

Note that you don't want to disable the "Java Proposals (Task-Focused)" that that error message was trying to tell you about. That'll disable name completion as well.

Newell answered 2/9, 2009 at 12:14 Comment(0)
S
0

I was having the same issue, but my problems started when i upgrade my project from gwt 1.5 to gwt 1.7. I read your comments and i just make two changes. Increase the Xmx to -Xmx768m and unmark Java Proposals (Task-Focused) and mark just Java Proposals. It's being work fine since i did this changes. I hope it can help you.

Scraggly answered 22/9, 2009 at 17:22 Comment(0)
B
0

I had the same issue on eclipse 3.5. Upgrading mylyn features resolved it

Boyd answered 16/10, 2009 at 11:13 Comment(0)
D
0

Mylyn (or its code assist) seems to be rather picky about resources in the build path.

I had the issue and it was caused by binary files which I had accidentally added to the Eclipse built path. That does not cause any compile error or warnings but causes the exception during code completion you mention in your post.

Doughboy answered 12/11, 2009 at 15:8 Comment(0)
T
0

Configure Eclipse’s content assist, go “Preferences>Java>Editor>Content Assist>Advanced“. Make sure “Other Java Proposals” is ticked. This may be easier solution... :-)

Thorne answered 20/12, 2011 at 13:54 Comment(1)
Read the question a bit more especially the bit under "UPDATE 2". It's an Eclipse bug and no Content Assist settings help. The bug is fixed in Eclipse 3.6M6.Nickey
O
0

One of my jars was on a network share and it was hanging for over 10 seconds. Copied the JAR to local drive, updated my project to point to the local file and my hang time went away.

Obligato answered 7/1, 2013 at 17:30 Comment(0)
T
0

I was facing the same issue.

I added -vm option on top in eclipse.ini file just before -startup option. And it solved the issue!

-vm
C:\Program Files\Java\jdk1.7.0_71\jre\bin\server\jvm.dll
-startup

My eclipse version is 4.4.1 by the way.

Theomancy answered 16/10, 2014 at 10:52 Comment(0)
P
0

With STS 4.7.0, following throws errors, Arrays.asList("abc", "bbb", UUID.randomUUID()).stream()., but this will not, Arrays.asList("abc", "bbb", UUID.randomUUID().toString()).stream().

Paltry answered 28/12, 2020 at 7:51 Comment(0)
H
0

I had tried all the above suggested solutions but nothing worked for me. Then I tried manually adding the imports to my Java class and it worked. Give it a try.

Holy answered 15/7, 2023 at 4:21 Comment(0)
B
-1

Try restoring the preferences at Java -> Editor -> Content Assist -> Advanced.

It worked for me !
I use STS 4.14.0.RELEASE and it was showing the same error after there was an unexpected system restart happened. STS was not even allowing me to navigate to other classes by Ctrl+click, search for the class/method/variable references in the project.

Bluebell answered 5/7, 2022 at 7:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.