Eclipse autocomplete showing the proposals without filling them - java

I have just installed the Eclipse IDE and I searched on the internet how to configure the autocomplete. I found a good method and after that I implemented it. But, now I'm very curious if the autocomplete can be set to show the proposals without filling them if I don't want to.

I thing your question is that when you press the shotcut of automatic complete,then it fill the code automatically without a confirmation
the reason is that the result of your attemp to complete is just only one,so there is a mechanism that when the result of the attemp to complete is just only one,then it will be automatically filled
but you can set up this mechanism in in the following way
windows---preferences---java---editor---contentassist---insert single proposals automatically

If you press CTRL + Space it should show the autocomplete and you just have to press enter for it to fill in.

Related

Apply Intellij Code Improvement Suggestions

I'm using Intellij for Java development. In the code editor on the right, it displays some yellow markers which indicate issue with my code, e.g. improvement suggestions. When I hover over the affected code line it tell me what to do. Unfortunately I didn't find a way of automatically applying said suggestion. How do I do that? I don't want to do fixes by hand but rather allow Intellij to do them for convenience.
CTRL + Space is only code completion.
Just place the cursor over the highlighted code, hit Alt+Enter, select the suggested fix and hit Enter.
You can also apply the fix for all problems of the given type within specified scope (current file, project, ...). If you want to do that, just select Run inspection on from the menu that is shown.
I'm not sure if there is a way to apply these fixes automatically completely without user intervention, but even if there was, it probably wouldn't be very user friendly, as the warnings are sometimes false-positive.
If you want to apply a code suggestion it it simply Alt+Enter while the cursor is over the highlighted code. I would strongly suggest not automatically applying suggestions and to use your better judgement.
I can personally attest that while it's a little extra work, being able to choose the suggestions validity is much better. There's been more than a few times when the suggestion wouldn't make sense in the context.
As a sidenote I'd suggest having a reference for the KB shortcuts open so you can improve your speed within the IDE: Mac or Windows/Linux

In IntelliJ is there an easier way to set up the "Complete Current Statement" like eclipse?

I have used Eclipse for Java for the last few years and am trying out Intellij. I'm not using it permanently because it isn't as useful for quick programming (like how you can't just drag in files into the src folder) but for doing certain things, I think it will be faster for me.
I know there is Ctrl+Shift+Enter, but this is just annoying to press. Not because it is awkward to press, but because it takes so much time compared to just pressing enter like you can in Eclipse. I tried to rebind it to enter, but then it just doesn't work.
Is there a way to set up the Complete Current Statement so that it happens when I press enter?
Like, is there a way that I can bind it to Enter, but have it checked before the editor checks for enter as move to next line?
If you want only basic Code completion and not Type completion, use Ctrl+Space
IntelliJ and Android Studio are pretty highly customisable. You can rebind shortcuts too, I believe. Have you looked here? https://www.jetbrains.com/idea/help/configuring-keyboard-shortcuts.html
Also cheatsheet might be of use: https://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard.pdf
And Android specific bindings: https://developer.android.com/sdk/installing/studio-tips.html

Eclipse autocomplete change variable names

just a dumb question but its hard to search because there are so many topics about eclipse auto complete and its hard to find something matching to my problem.
so there problem is:
If i write :
"MyClass MyVarName" and then hit space, (to add the " = new MyClass()")
Eclipse automatically adds : "MyClass MyVarName_MyClass " or something like that to the variable-name..... (just without underscore.... stackoverflow just wont to mark as bold else...)
That is really annoying, and because i imported the eclipse configuration of a co-worker... I really don't know how to disable....
thanks in advance
//EDIT:
It seems to be the same effect as i type "MyC" and then press space, it also completes the "MyClass" and not add just the space... its like hitting enter. but i dont want to automplete on space...
i also didn't found a custom key option on space or else.... :(
In Window->Preferences->Java->Editor->Content Assist:
check the box at "Disable Insertion triggers except 'Enter' ".
I've found all other answers to also disable the auto-suggestion features of Eclipse, which are rather useful in my opinion.
Window -> Preferences -> Java -> Editor -> Content Assist -> Advanced: In the top list box, uncheck "Java Non-Type Proposals", "Java Proposals" and "Java Proposals (Task-Focused)".
I cannot find a way to solve it decently.
So, just, press Esc before press Space.
Look into
Window -> Preferences -> Java -> Code Style
There you can see Conventions for variable names. Make sure all prefixes and suffixes are empty. Also check in
Window -> Preferences -> Java -> Editor -> Content Assist
Looks to me that you might have the Control key pressed without knowing it. Happens sometimes on laptops with Fn key that Fn+Ctrl kind of "locks" the Ctrl. I conclude this because Eclipse auto-complete feature should not work on pressing Spacebar only. Normally you should get the effect you describe only by pressing CTRL+Spacebar. Thus, try pressing Fn+Ctrl to unlock the "pressed down" Ctrl key and then you should be fine.
In Window -> Preferences -> Java -> Editor -> Content Assist, there is the option "Auto Activation". If you have it checked, it will activate even if you don't press ctrl and you'll see that behaviour. Uncheck it and you'll only get content assist when you use ctrl+space.
S!
My suggestion, and what I do, is similar to GreenEyed's approach but instead of disabling auto activation put it to a reasonable value for the delay, like 3000 (3 seconds).
I had plain Eclipse IDE for Java EE Developers and installed the Spring plugin to try it out. I didn't like it and didn't use it so I uninstalled it. After uninstalling, it still had the setting that you describe. So annoying!
After search for hours, I finally found out how to disable it.
Windows > Preferences > Java > Editor > Content Assist
Set Auto activation triggers for Java to: .
That's all that's necessary.
If you want to restore other Eclipse defaults regarding content assist:
Set Auto activation delay to 200.
I had previously disabled Java Proposals, Java Proposals (Task-Focused), and Java Type Proposals, as others recommended, but these should actually stay checked, so I re-enabled them.

Linux or Sublime Text tab-style auto complete for Eclipse?

Is there a way to enable Sublime Text style tab-autocomplete in Eclipse. I've gotten very used to simply typing the first few letters of a variable name in Sublime, hitting tab to complete the variable name, and then moving on without thought. It's proving to be a tough muscle memory to break as I transition to Eclipse.
I know about CTRL + Space for bringing up the code completion menu for automatically generating certain attribute names and whatnot, but I'm more referring to that really quick completion of names while I type them.
Maybe a quick eclipse hack will work for you?
I have never used Sublime's autocomplete, but it sounds like Xcode has something similar. Just fill the "auto activation triggers" textbox with any/all characters that you'd want to toggle autocomplete.

is there Eclipse useful Add On for AutoComplete function like xCode?

I've started up with developing Java.
However, These days I've started iPhone project and gave me lazy writing code;auto code generate functionality in xCode.
Are there any non-pay free edition add-on exist that does similar to xCode?
I mean, I do know Eclipse already has partial auto method look up when you put '.' (dot) token after class name which shows the list of methods.
thank you all.
The functionality is called content assist in Eclipse. It comes as default.
To trigger content assist, normally you have to click Ctrl+Space (Windows/Linux). But as you said, on Java it will be auto-activated when user press ..
You can however change this behavior. Go to Preferences -> Java -> Editor -> Content Assist and change the Auto activation triggers for Java.
For example to get the behavior of xCode, you could change it to ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.
It comes by default with eclipse.
You need to press . then ctrl + spacebar
If ctrl + space doesn't work, you may try Alt + /
I used to think the autocompletion was slow, but it turns out you can make it instant. Go to Window / Preferences / Java / Editor / Content Assist / Auto-Activation and decrease Auto activation delay to zero.
I've been using Code Recommends. This is a very useful Eclipse plugin you must have.
One of my most favorite functionality is
Subwords Completion (you don't need to remember exactly the first letter of method's name, just type in other whatever letter you remember even they're inside).
It also offers many other functionality that may meet your need.

Categories

Resources