Thursday, February 2, 2012

VS2010 Auto-complete Usability

Usability Issue: Visual Studio 2010 Auto-complete feature

What makes using a development editor easier is the content assist menu that gives us more hints or information about what we can do. Specially, when you are using new APIs or would like to make your coding faster and less error-prone. The content assist feature in Visual Studio is improved and provides several handy suggestions to use. However, the way it pops up and disappears makes its use a bit clumsy.

When you type a character in a new line, the content assist menu will show up right away to give you suggestion on the auto complete, which makes it a bit surprising especially when you would like to type in something more as a comment, variable declaration, or loops, etc.

If you hit ESC on your keyboard, the popup will disappear which is fine, but as soon as you continue writing, it will show up again. Hit ESC unless we go to a new line, or finish writing the statement. Otherwise, you will keep pressing the ESC button if the auto complete menu is annoying you. It would be better to limit auto complete from showing up when we have short list of choices by clicking CTRL + Space.

Move Up/Down use:
Suppose that you would like to define a new variable typed by sbyte. As soon as you type the character “s”, the auto complete menu will show up right away, and by default the type sbyte is the selected one given that it is first entry for variable types start with the character “s”. If you hit enter, surprisingly, you will go to the next line, and only the character “s” is what was left typed in the previous line. The question will come into your mind, “Why did just this happen?” The issue here is the “auto complete” is not auto focused when the item of interest is the default one. You will still need to dummy move up and down to get it focused. Sometimes you may need to use your mouse to choose a selection. This behavior has been resolved in Visual Studio 2010.

The suggestion for better auto complete use is to only show the auto complete when using hot key (such as control+ space), or when using “.” to find out methods in APIs, classes, or the same class.

Auto-complete templates behavior:
Auto complete is supposed to make Visual’s use better without any typing tweaks. One of the most annoying things I always face all the time is the input box. When I type mbox, it shows up which is good:

However, when I hit enter, it will only type in “mbox,” which is a syntactical error unless you complete the statement. One of the hot keys I have to use in that case is “tab” – which is completely vague for new users – in order to show the complete line use:

Even with this hot key, we still have a problem with missing imports on System.Windows.Forms.
You will need to manually add this missing import. From usability perspective, we should have these imports filled in. And even if there are items in the auto complete that are going to cause errors, they should be filtered out in order to avoid confusion. For instance, with that behavior there is a possibility to find an item and after we add it, it turns out we cannot add the item as import. So, it is better to filter out problematic items from the auto complete menu.

Open body statement auto-complete
One of the problems I always face and annoys me is that the code editor does not close my open body statement. For instance, when I type “{” and hit enter, I am expecting to go to the next line, and find the editor added the ending statement “}” in the next line. However, what happens is I go to the next line, with more indents which is fine, but then manually I will need to go to the next line to add the body close brace, and then return up again:

Now, even when I add this missing brace statement, the auto complete shows up right away. Logically, whatever I chose from the auto complete menu will result in syntax errors as it means I am going to append some code right after “}”. Not sure why it even shows up it this point.

So, the user experience with this usability issue will be as following:
-          Type “{“
-          Hit enter to go to the next line
-          Go to the next line.
-          Add “}” to close your body.
-          Hit ESC to close the auto complete that will show up
-          Go up and start writing your code

Environment details:
Operating System: Windows 7 Ultimate.
Visual Studio Edition: VS 2010 Express C#

Microsoft Visual Studio 2010 Editions

No comments:

Post a Comment