Code completion strange behaviour (part deux)

Here's another question about the logic behind IDEA's code suggestions (Using IDEA 12.1). Consider this screenshot:
codesuggestions.png
Why does IDEA not select setText(String text) for the JLabel? I have to either use the cursor keys to get to the right line, or I have to go back and change the "t" into "T" manually, because if I hit "(" now, the method "settext(" is not recognized (obviously), but if I hit "enter", the wrong method is inserted.

Note that this is the auto-popup. If I hit CTRL-SHIFT-space, "setText(String text)" is selected.

Edit: When I set the option in Settings -> Editor -> Code completion it does work as desired, although the description of the checkbox does not suggest that it would do that.
codesuggestions2.png
Result:
codesuggestions3.png

8 comments

Hey, half my post is gone. I edited it to show an accidental fix, but that  is missing from this post...

0

Yes, you've found the correct option. Any ideas on how to make it more obvious that it controls the behavior you want?

0

Well, the label of the checkbox suggests it does something for the actual inserting of the selected item. The text doesn't make it clear that it also controls the behaviour of the list. To me those are two different functions that you can't set with one checkbox, so I am not sure what text to put there to make both functions obvious.

0

It tries to suggest that the selected item (so there must be some list, otherwise there would be no selection) can also be inserted in the editor by typing some characters different from Enter/Tab. I don't really understand which two different functions you're talking about. Could you please elaborate on that?

0

This is not about typing ( or enter for inserting the selection into the document. This is about the behaviour of the auto popup list when typing. When typing "sett", or even "settext", IDEA highlights "setHorizontalTextPosition", as seen in image #1. This is weird since there is an exact match with "setText" (except case).

I'll try to describe what I mean with the two functions:

Function 1: What I expect this checkbox to do, and in fact it does, is make IDEA insert the selected item in my editor with keys other than tab and enter. (The exclamation mark is also one of them, which is extremely useful).
Function 2: What this checkbox *also* does, and I didn't expect that, is change the behaviour of which line is selected when the user is typing.When this checkbox is enabled, the selection is not "setHorizontalTextPosition" anymore, but "setText". Also, the suggestionlist is no longer dimmed, but fully visible, with a blue bar. This is obviously no problem in itself, but it does show that something has changed about this suggestion list.

The behaviour change described in function 2 is not obvious from the description behind the checkbox. That mentions only the insertion of the selection and not the selection behaviour.

All things considered, it's a minor issue, but very hard to find for people who want a better auto popup suggestion list.

0

Aha, now I see what you mean, thanks for the clarification. Actually, it's related to the fact that you have alphabetical sorting on, and appears to be a bug. So a workaround is to turn on item sorting by relevance. Could you please file a bug request to YouTrack?

0

Yeah sorry, that was on my todo-list. :(

0

Please sign in to leave a comment.