Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Take for example I'm creating a new instance of a class that has an ENUM as a parameter. When I press the comma key MD knows it's an enum and shows Intellisense and puts that enum definition at the top of the list. However, the top item is NOT selected so I can't just press TAB and then period to select the ENUM. Instead I have to do some mouse work or keyboard work to select that top item. It really makes coding a little less efficient. If you could select the enum item in the intellisense list it would really help us accept the default selection and then just choose the enum from the list of enum items.
If the list doesn't select something by default, that means it's not able to provide a list of all valid values for that position. In such cases it goes into "suggestion mode" - for an explanation and some tips, http://mjhutchinson.com/journal/2011/02/monodevelop_tips_suggestion_mode for info.
In this particular case, it's because the completion list has been triggered by the fact that you're in the position of an argument that takes an enum value. It's particularly eager - it doesn't even wait for you to type a letter. It can take a good guess, but it can't know everything you might want to type for sure.
For example, what if you want to type a left parent for a (Cast) of some other value to that enum types? I suppose we could add that cast into the list too, so we could fix that case. But others aren't so easy. What about whitespace for alignment? Space commits in completion mode, so this would be annoying. In fact, this makes me wonder whether we should stop Enter from committing in suggestion mode, and limit it to Tab.
The biggest issue is other overloads of the method. MD can't know for sure which one you're using until you actually provided the arguments. Sure, if they take other enums, we could put those enums in the list too. But what if they take lambdas or numbers?
I think the problem would be solved if the top item in the popup list (intellisense) were selected. In all cases of an enum param it would choose the right one that I've seen. It's like a focus problem, not anything else. If only the list were focused and top item selected the issue would be solved.
Perhaps my explanation wasn't clear. The use of completion mode is a tradeoff between saving keystrokes and interfering with normal typing.
Completion mode allows accepting the completion values by typing space or punctuation, which is also inserted. This saves keystrokes. In suggestion mode, you must explicitly accept the value using the tab or enter key, or by using the up/down arrow keys to select an item before typing space or punctuation.
The problem with completion mode is that it only works perfectly if the list contains all the values that the user might want to type. If not, then when you type some other value out in full then press space, the completion list will overwrite what you typed with something in its list. This is *extremely* annoying when it happens. The only workaround is to watch out for it and press "escape" to dismiss the list when this happens. For fast typists, this pretty breaks the usefulness of code completion.
Obviously it's impossible for completion to know all valid values everywhere. For example, when typing a class name or a number, it doesn't know any (non-infinite set of) valid values, so it doesn't trigger at all.
There are some places where it knows *some values*, but not *all*. It's useful to it to be able to provide some assistance in these cases. Our solution - which is the same as Visual Studio - is for the completion list to be in suggestion mode in such places, so it will provide assistance, but not interfere with typing the other possible values.
In summary: the completion engine has a policy to never "overwrite" valid typing, as long as the code up to the caret position is valid. Fixing this bug would violate that in many cases.
Actually, having re-read your original report, I'm confused. You say that you can't press tab then period to complete the top item - but this works perfectly for me. This is exactly what you have to do in suggestion mode. In completion mode (if the item had a solid selection) you would only have to press period.
You can see it here: I press tab immediate after I press type "(".
Now, there is one slight oddity - it should be in completion mode after I type the ".", since does know the set of enum members. Is this what you meant?
In MD prefs I have ALL checkboxes checked in Text Editor / General.
When I am creating a new instance such as:
var myButton = new CustomButton(new RectangleF(0,0,0,0), <myenumhere>
When I press the comma after the RectangleF I get an Intellisense popup, however, the top item in the list, which is the enum and is correct, is NOT selected so that I can tab and press period.
Maybe next week, if needed, I can do a quick camtasia for you to see it.
In coding this weekend I see that if I just press tab when intellisense shows the list it does accept the top value. What is confusing me is that it's not "selected" (blue highlight) in the list as if you were to arrow up or down. It's "outlined" so the position in the list is correct, it's just not selecting the top item visually, i.e. highlighted in blue background white text.
Please take a look at the page I linked on suggestion mode. The outline indicates it's in suggestion mode, so you know it won't be committed by space/punctuation. This is exactly the same as Visual Studio.
Ah, I appear to have omitted the link from comment 4, sorry about that: http://www.screencast.com/t/zysnC6MSjiif
Okay, if you feel this is by design that's fine, just wanted to bring it to your attention as I didn't think I could tab with nothing selected in the intellisense list.
If you have suggestions for making it easier to understand that would be wonderful. I'm not trying to discount your input, just explaining the reasons that it behaves the way it does.
I did notice a bug when I was trying to repro the issue, as you can see in my screencast - after typing the ".", it should be in suggestion mode. I filed a bug for that - bug 4100.
You're just smarter than me on this issue as I'm not aware of the "suggestion" mode vs. just having an item selected (highlighted in blue) in the list. I would assume the top item would be "focused" i.e. not just outlined but actually selected so it's obvious to me that I could press TAB and it's going to use the highlighted item. I'll have to pay attention to VS.NET in the future to notice the behavior of the intellisense popup list in the future. If after that point I see a problem I'll certainly bring it to your attention.