About usability issues for Eclipse's auto completion - eclipse

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

Related

Automatic Insertion Trigger in Netbeans - Code Completion

I am using Netbeans 13 and whenever I type anything in the editor an autocomplete popup show up instantly.
This is really what I want.
But once I continue typing it choses the first suggestion which I don’t want. Then I have to delete the suggested object/method/variable…etc and write my own.
I am looking for a feature like the one in Eclipse IDE which only triggers insertion once ‘Enter’ key is pressed.
Also I don’t want to apply the delay approach.
Note: I tried Netbeans 12 but I faced same issue.

What are keyboard shortcuts to find next and previous error in Netbeans 8.2 editor?

EDITED (see bottom)
Is there really, after so many years of unanswered questions such as mine, no keyboard shortcut to jump to the next or the previous error in Netbears 8.2?
This page says that the shortcuts are
Ctrl+./, Next/previous usage/compile error
Note the inclusion of the word usage. In no other "Next/Previous" shortcut is usage used. I wonder why it's here and if it points to the problem. It's not exactly a typo. What might it mean? Yeah, probably nothing.
Whatever, absolutely nothing that I have found shows how to accomplish this very important pair of tasks.
Using Tools > Options > Keymap shows that Ctrl+PERIOD and Ctrl+COMMA are how to do it. But it doesn't work.
Once Ctrl+PERIOD took me SOMEwhere, and doing it again took me to the next occurrence of it, etc., but those lines of code had no errors and it doesn't happen now.
I've clicked on the ellipsis on the line for Next Error and Previous Error and edited them to be Ctrl+BACKQUOTE and Alt+BACKQUOTE and I clicked on the ellipsis and defined alternative shortcuts to be Ctrl+CLOSE_BRACKET and Alt+CLOSE_BRACKET and I could NOT define Next error in Editor to ANYTHING.
NOTHING works.
So my question is WHY NOT? I use F2 and shift+F2 in Android Studio with every error I get! How can this NOT be possible in Netbeans 8.2?
I am reluctant to upgrade to Netbeans 11 for just this, especially not knowing if this problem persists.
======================
EDIT
After looking at what #Dmitry_M submitted, I took another whack at it with the above definitions, which cause:
Alt+1 to take me to Next Error, but ONLY after a fresh Build or Clean and Build Project, and it takes me to other lines (in xml, for one) that have no errors (that I know of; they're not flagged).
Alt+2 to take me to Previous Error unless I fixed it, in which case it takes me to that same line that HAD the previous error, just as Alt+1takes me to where the next errors USED to be and to the other places, too.
Next Error in Editor to do nothing.
This makes me wonder what Category actually means since Next Error in Editor says Source while the others that DO work say System.
My source files have more than a few "yellow warning" indicators, but unike Dmitry, the definitions don't find them.
If it finds the errors among other things, that's better than it was. But it only finds errors already listed in Output, and it requires build, and it finds other extraneous "errors". So I'll just look at Output. Keymap fails.
I'm discouraged with Netbeans 8.2.
I am using NetBeans 8.1
Next Error in Editor
The keymap moves a cursor to any hint or error that the editor shows. They are sometimes not compiler's errors. See it in action.
For example, the cursor moves to int i = 0; but there is no error there. There is just a hint that variable i is not used anywhere. And in the import statement: it's just a hint.
If you want to define a keymap for Next Error in Editor action try different key combinations. I use alt+1.
Previous Error/Next Error
The keymap only works for clean and build or build actions.
Probably, when just editing and saving NetBeans doesn't refresh errors list somewhere in the cache. It explains the behavior you experience: the cursor moves to a line where there are no errors. It simply moves to the line where an error was during the last build or clean and build action.
Se it in action just after clean and build. It works:
The cursor indeed moves only between "real" compilers' errors. But it only works after clean and build or build action. Probably it's a bug. There is a relevant bug but it was not resolved.
Also, in my case, Ctrl+PERIOD and Ctrl+COMMA were not working completely. Changed my keymaps to this one:

Any way to prevent emacs key bindings to bug in Eclipse?

I'm wondering if I'm the only one struggling (i.e. failing) to keep the emacs key bindings working in Eclipse.
I set them. It works fine. The it stops working fine. Some keys still work, others don't. I find myself in a kind of weird quantum state of uncertain key-binding setup superposition. Some key bindings from the standard set work, some from the emacs set work, some things I can achieve with neither set of bindings.
I'm the only one to experience this? I've seen this on at least 4 computers in the past few months.
I set key bindings back to standard set. Sometimes it works. I use the reset to defaults button. Try to set it back to emacs. Doesn't work. Pressing the apply button between the different steps or not... Drives me crazy.
On some computers, the bindings are just whatever. Can only save using the mouse, C-d and C-k don't work to delete/cut lines, most emacs keys still work but back to C-space for auto-completion, etc.
Anyone knows what can cause this? How to prevent it? Am I pressing some key binding key-bindings by mistake?
I had a similar problem with the Ctl-K, Ctl-D commands: after doing an upgrade (I forget whether it was Eclipse itself or the Android plugin) I saw Eclipse offering a little pop up menu on both these keys, offering to do either the correct Emacs command or some completely unrelated command. So, for example, Ctl-D offered to either delete the next character (correct) or delete the line (incorrect).
After some poking around in the key bindings (Windows>Preferences>General>Keys), I discovered that sure enough, someons in the Eclipse project supplied these wrong bindings in addition to the correct ones. So I deleted the incorrect bindings and left the correct ones.
So I thought I would be out of the woods at this point. But I also discovered that I had to add the correct binding back in a couple of times before it would stick.
Look for Cut to End of Line under the Command column and make sure it has Ctl-K when Editing Text and in the Text Editing Category. The same for Delete Next (which means next character). But make sure Ctl-D does NOT show up for the Delete Line Command.
Test it out in an editor window; if it fails, go edit the bindings again, test again, repeat until it sticks, making sure you click Apply after editing the bindings.

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.

Validate Autocomplete in 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.