Validate Autocomplete in Eclipse - eclipse

Coming from Visual Studio and starting a project in Java, I realized I couldn't cope with having to press ctrl+space to have the autocomplete panel show up. An easy workaround was to set all keyboard characters to be trigger characters for autocompletion.
My only problem is that, when presented with autocomplete suggestions, a single press on the space bar will write the first proposition. In situations where I'm happy with the suggestions, that's just fine. In situations where I actually want to use what I wrote down initially, I have to press 'escape' first to remove the autocomplete panel before I can press 'space' safely.
Netbeans doesn't use the space bar as a validating key for autocompletion (only 'enter' does that) and I like that behavior. Any way to replicate it in Eclipse?
Thanks in advance for your answers!
EDIT: I should have mentioned I'm using Eclipse on the Mac.
Guillaume

I have the same problem with Eclipse Indigo on Windows XP actually. Coming from intellij idea, I also felt the need to set the whole keyboard to trigger auto-complete.
A quick proof that SPACE key does accept suggestions : type inte on a new line. If the auto-complete menu shows, press SPACE. It goes for Integer.
If anyone knows how to set the SPACE key to "ignore suggestions", it would be great, because the escape key on my keyboard is also too far away :)
Thanks
Edit : actually the best would be to have only the ENTER key validating, because ';' and '(' also seem to validate

I just tried to reproduce your behavior, but couldn't. Here is the configuration I have (and the steps I have done to reproduce):
I have installed Indigo (current version of Eclipse, version number 3.7).
I did not change any configuration there, this is what is the default:
Under Window > Preferences > Java > Editor > Content Assist, I have the following settings:
Completion inserts (instead of overwrite)
Insert single proposal automatically (which is ok most of the time)
not insert common prefix automatically
I have a simple class, go down to a method, and do the following steps:
Enter this.no and wait some time. Sometimes I have to press CTRL + SPACE, sometimes not.
Proposal pops up which includes notify and notifyAll.
I press SPACE and a space is inserted in the text, the autocomplete suggestions are closed without inserting anything.
I do not know if older versions of eclipse have the same behavior.

Related

VSCODE + Dart/Flutter: Double Autocomplete in conflict

i use visual studio code to create my flutter app, but since 1 month ago, i detected as if the editor have a double autocomplete.
When i write for example: "Container" i have the autocomplete while i'm writing, but if i press Enter it won't add the brackets at the end (before, it did!)
And, if i write: "child" i have the autocomplete while i'm writing, but if i press Enter, the cursor will be with a selection, and there is no autocomplete until i click in somewhere to remove the auto-selection, or i write the command completely without autocomplete.
It's like if there were a double autocomplete in conflict, that select the words after i press enter.
Autocomplete working:
Strange auto-selection and then no-autocomplete:
Furthermore, if i write "setState" and press Enter to autocomplete the function, i get the whole function selected and tabbed of 4 tabulation on the right. Same for initState.
I tried to disable every extension and restart, but i had same problem.
I'm so slow now to write flutter code, because i have to remember every CamelCase word and property and write them in every single char, or click in somewhere to make autocomplete works.
Fixed!
In setting i had to disable LSP.
"dart.previewLsp": false
I've the same issue, after some research I found this:
https://github.com/Dart-Code/Dart-Code/issues/2823#issuecomment-725630953
I'm not sure this is the right way because I didn't have try yet but the problem on GitHub issues seams the same you describe, apparently this solution works with LSP enabled

How do I select all text in vistual studio code?

In visual studio code (1.29.1) ctrl+a doesn't do anything for me. I checked keyboard shortcuts and it's mapped to a few select all actions (editor.action.selectAll, etc.) but when I'm in a file and press it nothing happens. How do I select all text in the current file in visual studio code?
Thanks for the comments, it make me realize it must be an environmental issue. Turns out if you have any mapping starting with a key combination that will lock that mapping to the key combo and you can't use it for anything else.
To make save all ctrl+shift+s I had to re-map save as and I mapped it to ctrl+a+s, so everytime I hit ctrl+a it just waiting for second key. In the status bar at the bottom of my editor it said something like "Ctrl+a detected, waiting for second keystroke", which means Ctrl+a won't work on its own. I re-mapped Save As to some unused key combo and it fixed select all.
This question was luckily answered on another thread
I'll post the OG answer here, nonetheless.
Most new comers to VS-Code could resolve this issue with the 2nd method provided by the OG answer:
Goto File > Preferences > Keyboard Shortcuts
in the search bar type this Select All
There's should a couple of results, you'll obviously want the "Select All" result
right click on his line and click on Change When Expression
a textbox would be highlight for you to fill in text. type editorFocus
press enter and done!
The OG answer provides image if you need to confirm that you're doing it right.
side-note: This issue bugged for more than 3 years and is the main reason my I used VS-Community over VS-Code.
So it's nice to finally be able to work normally in this very robust customizable IDE text-editor.

Special keys in Eclipse Issue - IDE always asks for confirmation

Last days I have an issue with eclipse when I press special keys inside the eclipse
IDE.
e.g when I press Ctrl+C
then a small window appears on the bottom right corner of the IDE which
is like this:
Copy | Ctrl+C
The same is for other keys.. I got:
Inline Editing|Enter (when press Enter)
Paste|Ctrl+V (when Ctrl+V)
It is really slowing down typing because it gets the focus and need confirmation clicking
on the right part of the small window.
Does anyone know how can I fix it?
Thank you!
The pop-ups you are seeing are the "keybinding conflict" popups. These are common when you have two different plugins defining the same keybinding and looks like these. This may happen if you installed some plugin which attempts to override the default bindings.
You may investigate your current bindings using "Window>Preferences>General>Keys". Enter the binding (eg. "Ctrl+C") in the filter field (it has "type filter text") and see all the commands that have this key combination bind to. If you have two different commands with same "When" parameter, then there's a conflict.
You may "unbind command" and then bind it again. Or try using "Restore command" button.
Also you may try to un-install the ill-behaving plugin, if you don't need it actually.

Eclipse content assist auto appends type for variable

I just started to use Juno for a couple of days, the content assist mechanism seems different from what it behaves before.
For example, if I try to declare a variable
Boolean isVisible
The content assist of Juno will give you a drop-down list with the variable name
isVisibleBoolean
as hint.
And the very annoying thing is that no matter what I typed in(; or SPACE), the "isVisibleBoolean" will be selected.
Does anybody know how can I disable the auto-variable-type-appending thing?
Much appreciated.
I'm using Mac OS X 10.8.1 currently, haven't tested it yet in windows.
Based on the discussion for Eclipse Bug 412992, check your Content Assist Auto Activation settings:
Window->Preferences->Java->Editor->Content Assist
If, for example, characters a-z are listed as "Auto activation triggers for Java", you can remove them and the type name will not be auto-appended to a new variable name when you hit ' ' or ';'. It's up to you to determine the best configuration/tradeoffs for your style based on the available options.
It seems that it is not possible.
See answers to Eclipse Bug 378588: https://bugs.eclipse.org/bugs/show_bug.cgi?id=378588
This is still a problem in Eclipse 2018-12 and it only seems to occur if you changed the Auto activation triggers for Java setting to e.g. ._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ, which'll make the Content Assist (almost) always pop up, even without pressing Ctrl+Space (Windows).
There's a new setting that was added in Eclipse 2018-12 and makes it a bit less annoying (mentioned in the comments below the bug report):
In Window - Preferences - Java - Editor - Content Assist tick the Disable insertion triggers except 'Enter' box.
With this setting enabled, Content Assist is still going to trigger (depending on the other settings) but you have to press Enter to accept a suggestion.
Not a perfect solution:
Window->Preference->Java->Editor->Content Assist->Auto activation Triggers for Java: .ABCDEFGHIJKLMNOPQRSTUVWXYZ
In this way, only classes and types will be popped up for proposals.
Just a suggestion, the choice is up to you.
What you see there is name completion for object types. And this may often make sense, e.g. pressing Ctrl-Space after List book will complete that to List bookList. For primitive types this is not done, so int count will not get any completion when pressing Ctrl-Space. This would be a (not really good) solution to your problem by declaring the variable as primitve boolean.
What I really recommend as solution is to change your style of writing variable declarations. For your example, write isVisible = false instead, have the editor complain about the missing type declaration, hit Ctrl-1 (from wherever your cursor might be placed), Enter.

About usability issues for Eclipse's auto completion

Recently, I need to use Eclipse instead of Netbeans.
I find the following issues is annoying in my case. Say, I key in the following wrong method name.
So, I tend to fix the error, by deleting the wrong method name (But not parameter, as I know I want to pass in true), including the dot. I key in dot again, Eclipse auto completion will prompts me list of methods
I am happy with the suggestion. I press ENTER. However, this is what I am getting.
Now, I need to manually deleted the uselesss (checked). This is pretty annoying, especially when the method takes in 4 to 5 parameters. I have to delete them 1 by 1.
I consider this a usability defect. I do not have such issue in Netbeans. Anyone of you know any workaround to overcome this usability issues? Is there any options I can turn on or turn off?
You can also press Ctrl+Enter to insert the completion which will 'replace' the incorrect typed word.
Look for "Toggle between inserting and replacing content assist" in http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.jdt.doc.user/tips/jdt_tips.html