Bug 5475 - Wrong code completion for List<>
Summary: Wrong code completion for List<>
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 3.0.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2012-06-02 14:42 UTC by pinggi
Modified: 2012-06-04 15:07 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Less troubles (18.47 KB, image/png)
2012-06-04 12:44 UTC, pinggi
Less troubles with ctrl+alt+space (65.26 KB, image/png)
2012-06-04 12:44 UTC, pinggi

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description pinggi 2012-06-02 14:42:11 UTC
Let's say I want to write 'List<int> list = new List<int>() definition.

1. So I start writing...


2. Now the popup window displays the list of possible choices. I continue...


3. Now the popup window shows 'ListMnemonicLabels' as the current item. I continue...


4. Now the popup window disappears and it ends up with...


5. I wanted to write "List<" and I end up with "ListMnemonicLabels<". Grr.

6. I need to remove "MnemonicLabels" to be able to continue with my writings.

This happens because there isn't "using System.Collections.Generic;" on the top of the file.

However, the common scenario is that you write 'List<int>' and then press a shortcut key, which generates using statement automatically. It is not possible in the Monodevelop.
Comment 1 Mike Krüger 2012-06-04 01:37:54 UTC
control+alt space solves that;

you can do List<int> list; and then right click on list to add the namespace as well.
If there isn't the item in the list you have to cancel the completion list with escape.
Comment 2 pinggi 2012-06-04 12:44:17 UTC
Created attachment 2018 [details]
Less troubles
Comment 3 pinggi 2012-06-04 12:44:54 UTC
Created attachment 2019 [details]
Less troubles with ctrl+alt+space
Comment 4 pinggi 2012-06-04 13:15:26 UTC
Mike, I reopened this bug. 

For me it is a bug, because I wanted to write "List<int>" in the text editor manually and text editor writes different text.

control+alt+space doesn't solve it!

I don't look at the screen all the time. Also think, the context menu should help me, not push me to choose something from a dialog. It stops me from writing a code.

I try to explain it again.

1. I want to write "List<int> list = null;" by my fingers manually without looking at the screen.

2. After I write it, it ends up with "ListStore<int> list = null;". Why? I don't want to help, because I know what to write. ButMonodevelop text editor changed my text, so I had to go back with cursor and delete it!

I have attached screenshot situations. You can look at that.

My opinion is that the text editor should write keys which I press. If I need help, I can ask by 'ctrl+alt+space' or by pressing 'tab' key to complete a word.

If I write 'List' and then press '1', it doesn't complete the word, so why it should complete the word if I press '<'? It chooses possible words or statements from the popup list. So what is the problem with selecting right word in the popup and pressing the 'tab' key or the 'enter' key? Why should I need to cancel it?

According to me, this is really wrong behaviour. It should not complete the word if you don't want to.

>>you can do List<int> list; and then right click on list to add the namespace as well.

Is there working shortcut for it? I would like to write 'List<int>' and then press 'ctrl+.' or 'shift+alt+F10' or another to automatically add 'using' statement. I don't want to use mouse if I'm writing a code. It is slow to move hand to mouse and move cursor to word right click, choose some category, choose right item, click, move the mouse cursor away and move my hand back to the keyboard.

Think about it please before you close the ticket.
Comment 5 Mikayla Hutchinson [MSFT] 2012-06-04 14:33:58 UTC
This is how completion mode works. If you prefer to type things out-of-order, you may prefer to enable suggestion mode, as explained here: http://mjhutchinson.com/journal/2011/02/monodevelop_tips_suggestion_mode
Comment 6 pinggi 2012-06-04 15:07:03 UTC
Wow, really cool. Thanks a lot! I haven't known that.