Eclipse - Ctrl+Space Content Assist doesn't work - java

I have just installed the 2020-12 version of Eclipse IDE, and I simply cannot get the Ctrl+Space suggestions to work. Every time I try to use them I get an empty suggestion box.
I've already searched for this of course, and I've found many who suggest how to fix it.
https://superuser.com/questions/209752/eclipse-doesnt-autocomplete-and-find-references-anymore
Eclipse - CTRL+Space autocompletion does not work any more for Java
https://mkyong.com/java/content-assist-ctrl-space-is-not-working-eclipse/
No Default Proposals in Eclipse Juno
Eclipse/Java code completion not working
Most of these say I need the Other Java Proposals in the settings, but if you look at the image you see that that option doesn't even exist! In the image the default settings are applied but I've also tried to check every single one of those boxes and still get an empty suggestion box when I press Ctrl+Space at the end of Combi (also in the image).
Image of the issue and my settings: https://imgur.com/a/CVRRgC0

Related

How to fix Eclipse autocomplete not working

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.
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.
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.
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)
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.
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!!!!
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.
Go to Windows >> Preferences » Java » Editor » Content Assist. Then Check the Auto activation triggers for java, Add this in the text box .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
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.
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.
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.
Saving my work and restarting Eclipse solved this for me. I hadn't shut down Eclipse in a while, maybe weeks.
I had the same problem (MacOS Monterey, Eclipse 06-2022). Turned out it works with pressed fn button.
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"

No syntax highlighting in eclipse for java

There is no syntax highlighting in java files in my eclipse..This happened all of a sudden..Not sure why..
This is how it is looking now..
As mentioned in other posts..i tried to change the color from preferences window and there is nothing when i type java..something really messed up...
AAny suggestions..
Update:
It seems Java plugin is not installed..as per the below screeenshot
And when i try to install java plugin it says new version is already installed as per the below screenshot
Closing the file's tab and re-opening it fixed it for me.
(I actually closed all the tabs...)
I faced the same issue all of a sudden after a commit/update project operation.
The point is, default editor of Eclipse has changed somehow and we have to set it back to normal.
Try the below method,
1. Goto Windows -> Click Preferences
2. From the Preferences window goto General -> Editors -> Click File Associations
3. You can choose the default editor for *.java files here
When I first opened Preferences, 'Text editor' was set as the default editor for .java files and then I changed it back to 'Java Editor'.
Now it works perfectly fine.
You probably have a corrupt installation or you have recently installed a corrupt plugin.
The following steps might help.
In your Install window,
view your "already installed" plugins.
select the "Installation History" tab.
select a previous stable configuration
Click the "Revert" button
TLDR; open another workspace, then come back to the original workspace.
Ok this is odd, but for me, all the highlighting suddenly went away for Java files. I explored all of these ideas here, with no effect. I created a new workspace, planning to move everything to it. I realized that can be a pain to move many projects over, so I went back into the original workspace to look at some settings, and poof - the highlighting was working again.
I have one java class file like a text editor.
I tried following,
Select the respective java class file from eclipse.
Right click on the file and mouse hover on "Open with".
Select java editor.
Now its works.

Source code navigation and JavaDoc bug in Eclipse Indigo

I have a problem with Eclipse Indigo regarding library source code. When I open a library class (e.g. from the JDK, but also from some other included libraries, such as Guava), either using the Open Type dialogue or simply through Ctrl+ click on the class name or some of its methods, once in a while (not always) something breaks.
Don't get me wrong, the source is always displayed without any problem (either JDK source shipped with the JDK itself or Guava source downloaded by Maven). What actually stops to work:
When I open the Quick Outline popup in that given class using Ctrl + O, the list of methods and fields displays normally, but when I click on any of them, Eclipse doesn't move the view on it as it should. Also Ctrl + clicking any of the methods or fields of that class in my code doesn't bring me directly to it, but simply at the top of the source file.
When I hover over that said class or its methods, no JavaDoc appears in the popup as you can see in the attached image. I am in the HashSet class, the source is clearly there, but it isn't displayed in the popup.
I found out that this can be fixed by opening the Outline View and briefly clicking through the class's methods and fields. After a few clicks, Eclipse catches on and starts to work correctly, but only for this one class, not for all which are broken in this way at the moment.
Has anybody met this kind of bug? Is it tracked at Eclipse Bugzilla? Thanks in advance for any advice.
For completeness, this is my configuration:
Windows 7 Professional x64
Oracle JDK 1.7 Update 2 32b
Eclipse Indigo for Java EE Developers 32b
your issue #2 may be resolved by following these steps :
Go to http://java.sun.com/j2se/1.5.0/download.jsp and choose to
download the JDK 5.0 Source Code.
For JDK 5.0, select Download(SCSL source).
Download JDK (SCSL) 5.0 (1.5.0). This will give you a file jdk-1_5_0-src.scsl.zip. You do not need to unzip this file; Eclipse likes it the way it is.
In Eclipse, go to Projects -> Properties -> Java Build Path -> Libraries and expand JRE System Library [jre 1.5.0], then rt.jar. Select Source attachment and click Edit...
Select the above zip file. and Finish by exiting the dialog boxes.
source
Hope this helps..
Sounds like wrong sources are attached to the libs inside Eclipse.
I had similar symptoms in a project where a class exist in both: inside a lib and in the project's src folder. Same canonical class name, but different implementations.
I would recommend to verify (or reinstall) your JDK-Installation and re-configurating it in Eclipse.
Hitting Ctrl+Shift+T and typing HashSet and taking a screenshot of that window may help here, too.
To answer my own question, I didn't find out how to solve the problem in Indigo, but updating to Juno fixed it.

Any way to get IntelliJ-like autocompletion in Eclipse?

I'm stuck with Eclipse in one project and I would like to have autocompletion similar to that of IntelliJ - two major problems are:
Start typing and Eclipse would automatically suggest all possibilities
When there is item selected in dropdown list you can accept it not only with enter key but with dots, spacebars...
Go to Window → Preferences → Java → Editor → Content Assist.
In the column "Auto activation triggers for Java", enter this:
.qwertyuioplkjhgfdsazxcvbnm_QWERTYUIOPLKJHGFDSAZXCVBNM
Add any other keys you want. You're done. That answers your first query.
As far as second one goes, I think it already exists.
Take a look at Eclipse Code Recommenders [1] or Codetrails Connect [2]. They make Eclipse' code completion intelligent.
[1] http://eclipse.org/recommenders/
[2] http://marketplace.eclipse.org/content/codetrails-connect-community-edition/
I have to say NO. I moved from Eclipse to IntelliJ because of the intellisense and inability to make Eclipse behave like IntelliJ (or if you come from the .NET environment: inability to make Eclipse intellisense behave like ReSharper in .NET).
Do you HAVE TO work in Eclipse? I do 98% of work in IntelliJ, then convert the project into Eclipse project (IntelliJ can still access it) and finish it in Eclipse. Maybe you could try this solution.
Since Eclipse Juno, Code Recommenders Intelligent Java Proposals replaced the old JDT's Java Proposals.
It afford "Intelligent Code Completion" function, like IntelliJ did in a way.
You can get something useful through the link below:
http://code-recommenders.blogspot.jp/2012/07/code-recommenders-10-code-completion-on.html
There is something like that in Eclipse I think, certainly in the Eclipse Helios. When typing you press CTRL+SPACE, or when you typed variable name '.' will start auto-complete options.
Also here someone suggests to change auto complete delay settings to 0.
BTW you can also accept your selection with space bar, for sure.
EDIT:
Why not consider using NetBeans, my personal favourite. There you have an option to show auto-completion on start typing any Java Identifier Part. This would then look exactly as you want it. (in NetBeans Tools->Options->Editor->Code Completion, there in Language box select Java and finally check Auto Popup on Typing Any Java Identifier Part).

Why does Eclipse 3.5.1 narrow to the declaration when I go to the declaration of a field?

I just installed 64-bit Eclipse 3.5.1 on SnowLeopard. I am experiencing a rather strange problem, and I'm posting a question here to see if anyone can explain or confirm it before I go get tangled up with the Eclipse bugzilla.
I open up a Java class with some errors in it. I double-click on a reference to a field. I click right and select 'open declaration'.
The windows then shows me ONLY the declaration. I smell a feature here, but I can't figure out how to get Eclipse to go back to displaying the entire class except by closing and reopening the class.
Go into the Eclipse Preferences and under Java > Editor you will see a checkbox for "Only show the selected Java element"... what you describe sounds like the behavior when that is checked. Try unchecking it.
Good luck.

Categories

Resources