Improving Eclipse autocompletion? - java

Currently the Eclipse autocompletion seems only to be triggered after a dot or on parameters, I want to use it for variables too, e.g. if I have
String test="hello";
then I want the autocompletion to suggest "test" if I start typing "t" in the next line (e.g. if I intent to change the value of the variable test).
Is there any Eclipse plugin capable of doing this? I already checked the Eclipse content assist options, but seems like there no option for what I want? Thanks for any hint!

First of all, thanks for all the replies. They are correct, however you have to press the key combination each time. Here's how it's done automatically:
That plug-in is not necessary any more. Just go to
Preferences > Java > Editor > Content Assist
and paste:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.
into the "Auto activation triggers for Java:" field.
This simply triggers auto activation after any English alphabet character and after dot.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=159157#c12
Works fine :-)
Hint: You probably want to additionally set the auto activation delay to 0, at least if you are used to visual studio ;-)

In addition to the suggestions above, did you try ALT + / it does incremental matching? No?

ctrl + space

If you press ctrl+space key combination, eclipse will show you the code assist window.
Type t and then hit ctrl+space, it will show you possible matches

You can press "t" and then Ctrl+Space..
is it?

In Eclipse
Window--->Preferences---> search for Content Assist under Content Assist go for Advanced
and check the Java Praposals.
done.

Related

Intellij change "first suggested fix" key?

I can't find the KeyMap entry for changing the default AltShiftEnter to apply the first selected fix (in Java code) for a problem in Intellij.
See this screenshot:
I think the combination is too difficult (I'd like to use one hand and max two fingers) and want to change it to Eclipse's Ctrl1
How to change this?
There is related request on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-217465
As a workaround you could put caret on red code, press "Alt+Enter" and select suggestion with arrow keys.

How to make Eclipse not insert Content Assist suggestion

In order to make Eclipse's content assist more like Intellij's, I changed the "auto activation triggers" setting to pop up the content assist window whenever I type, as mentioned in this question.
However, now whenever I press Space it inserts the content assist suggestion, even though I wanted to type a space.
Is there a way to make eclipse insert the suggestion only when I press Enter, not when I press space?
There is no way to control this. Open a feature request in Bugzilla: https://bugs.eclipse.org .
In Preferences>>Java>>Editor>>Content Assist, select Disable insertion triggers except 'Enter'. This handles the space bar issue.
You'll still get inserts sometimes, when there is only one proposal. I lived with this for a while, but I needed to disable it so I could use content assist in a plug-in to only provide suggestions.
You can turn this off by disabling Insert Single Proposals Automatically in the same menu.
Below image shows how can you bind the key to Content Assist command.

Eclipse Content Assist Struggles

Lately Eclipse's content assist feature has been giving me some frustration.
I recently changed my Auto Activation trigger so that the autocomplete box would appear whenever I start typing, rather than just after I type a period.
This is great most of the time but it has some annoying downsides. For example:
Eclipse autocompletes 'String' to android.R.string. This is very very annoying considering it changes "String" to "string" when I press space or enter. Why would I want that? android.r.string hasn't even been imported!
Here is what my content assist settings look like:
Two desired solutions would be the following:
Don't show proposals that don't match case (little 's' shouldn't match big 'S')
Don't show proposals that I have not imported.
If anyone could help me out with this it would be greatly appreciated!
Try these:
1. Sort the proposals by relevance and not alphabetically.
2. Hide proposals not visible in the invocation context (you have this one) and
3. Hide deprecated references

Eclipse IDE Scope Highlighting?

When I first learned Java, I was using an IDE called "BlueJ." It had this feature called "Scope Highlighting" which made it very easy to read blocks of code. Now I've moved on from BlueJ and began using Eclipse. I'm currently in the process of customizing Eclipse to my liking and would like this Scope Highlighting feature inside Eclipse.
I've searched everywhere for an answer on how to do it but I cannot find any information pointing to a solution for doing it in Eclipse.
Here's a picture to demonstrate what Scope Highlighting looks like:
I think the best option for you is EditBox, a scope highlighting plugin for Eclipse:
http://editbox.sourceforge.net/
I'm afriad that closest you can get is Shift + Alt + arrow_up
It is selecting wider block of code. pressing this few times will give you very similar result to what you are searching for. I use it often.. it is useful, also for refactoring.
EDIT: As #j2emanue said: you can just double click the delimiter (like a bracket) and it will highlight the entire scope.
you can use Shift + Alt + arrow_up but many people dont realize you can just double click the delimiter (like a bracket) and it will highlight the entire scope. Try double clicking your if statements bracket for example and watch eclipse highlight the entire scope. It works with any delimiter. so you can use parenthesis as well.
as a side note: if your using intelliji checkout this plugin works great: https://github.com/izhangzhihao/intellij-rainbow-brackets#screenshots
This isn't exactly what you're after but you can put your cursor in a method and then click the Show Source Of Selected Element only button on the toolbar. Your editor gets reduced to just that method. Click again and your back to your entire file.
I doubt eclipse does have the same function as blue j.The best advise I can give you, is to change your theme to your liking which would enable you to easily select and highlight the block of code...and to customise your theme , go to http://eclipsecolorthemes.org/. ....
If you still have a problem, go to http://codejava.co.uk/contact.html and send your email.you can create a dummy one if want, then I will send you XML files I use for my eclipse themes.
can Bracketeer do this ? its an eclipse plug in ..
http://marketplace.eclipse.org/content/bracketeer-java-jdt#.UK6sY4fAdLc
Maybe you will also like the VSCode extension "Blockman". It highlights nested code blocks based on curly/square/round brackets, html/xml tags and Python/Yaml indentation. (I am the author of Blockman).
.
https://i.ibb.co/31F0rm9/vscode-blockman-intro-leodevbro-extension3.png
.
.

Eclipse text cursor has changed and editor behaves differently

I pushed a magic button and now my cursor (the blinking thing that shows where you type) split itself and now Eclipse is acting like a plain text editor/like Microsoft Word. The cursor, which usually looks like "|", now looks like "¦" (what Wikipedia calls a 'broken bar' or a 'parted rule' rather than a normal 'vertical bar').
I just want to know how to get Eclipse to act normal again, and what I accidentally did so I don't do it again.
It sounds like you have accidentally switched from Smart Insert mode to Insert mode.
Press Ctrl + Shift + Insert or tick Smart Insert Mode on the Edit menu to switch back.
Smart Insert is the feature that automatically insert closing quotes and brackets when you type the opener and places semi-colons at the end of the line when you press semi-colon (if you have the preference for that enabled.)
Maybe you pressed the insert key, which will change the Eclipse editor to Overwrite rather than Smart Insert (see the info bar at the bottom of the editor), and will change the cursor to a block rather than a vertical line?
Update: Thanks for clarification - see mikej's answer which is correct. I'll leave this answer in case anyone has the similar, related problem that I describe.
Just double click on "Smart Insert" / "Overwrite" in eclipse status bar
For reference, I am adding image.
If nothing works, restart eclipse. That is what I did !
Just click
Toggle Vrapper Icon in Toolbar..
That may causes some issues like these. Because I'm also faced the same issue until today.
Please refer the below images to get clear idea about this.
Make sure that it is in disable mode in status bar
On my windows computer I press Shift + 0 but the zero has to be on the numeric keypad not the top row numbers.
Shift + 0 toggle my cursor.
#Jeremy by saying " I have a vertical line with a gap in the middle of it, like the character above the forward slash " i guess you are referring to the ' Pipeline 'symbol, the one you use to denote' OR ' in programming languages. As people already answered, you are in Raw Insert Mode (as opposed to Smart Mode) so try Edit->Smart Insert Mode (Ctrl+Shift+Insert by default).
For more info you can visit this thread http://www.eclipse.org/forums/index.php/t/53833/
And remember, the symbol is called 'Pipe' symbol or 'Pipeline' symbol.
I also had same problem, you can fix this by pressing just INSERT button on keyboard (on windows platform) also.
It worked for me.
or you can restart your eclipse.
I've encountered this symptom in Eclipse 3.7 before. And after I restarted machine, it disappeared.
If your cursor symbol is " + " then press Alt+Shift+A.
or else we can use Edit menu options ==> Toggle Block Selections
If you are using spring tool suite then you can double click on highlighted Smart Insert . Some keyboards do not have insert button.
enter image description here

Categories