Autocomplete annoyance with NUnit That() method?
I'm seeing some annoying behavior with R# autocomplete (R# 5.0 and VS 2010).
I'm seeing it with a method in the NUnit framework, but I'm guessing it's not specific to NUnit.
Using the Assert.That() method :

Notice that "SomeProperty" in the autocomplete pop-up is NOT selected. So if I hit the Tab key at this point, a Tab is inserted instead of "SomeProperty" and I end up with :

However, using the Assert.AreEqual() method :

Now "SomeProperty" is selected and hitting the Tab key at this point inserts "SomeProperty" as expected :

What's the difference between these two cases, causing autocomplete to behave differently? And, how can I get it to work as expected in the 1st case?
Please sign in to leave a comment.
Hello Dave,
The difference between 'Assert.AreEqual' and 'Assert.That' is that the latter
can accept a delegate as the first parameter. So when you type 'Assert.That(f)'
ReSharper doesn't know if you're planning to write something like 'Assert.That(foo=>...)'
or something like 'Assert.That(f.SomeProperty)', so ReSharper disables the
selection in the code completion list in order to avoid accidental completion.
But after you've typed 'Assert.That(f.Som)', ReSharper should enable
selection again. Apparently this doesn't happen, so I've created a bug: http://youtrack.jetbrains.net/issue/RSRP-184253.
As a workaround, you can use Ctrl+Enter to complete the current item even
if it's not selected.
Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"