Reputation: 9383
I'm using ReSharper 9.2. Example code:
class Foo
{
private int _someField;
private int _someOtherField;
public Foo()
{
Action<int, int> a = (_, __) => { };
}
}
As soon as I type type the ',' after the '_', R# decides I must really mean _someField
, and automatically inserts it. I have all three options (Symbol completion, Smart completion, and Import completion) unchecked under Options > Environment > IntelliSense > "Automatically complete single item with". But I suspect this feature is not the cause of the bug because there are 2 fields that begin with _
, so there should be more than a single item in the suggestion list.
It also isn't due to _
being treated as a magic character; if I name the fields xSomeField
and xSomeOtherField
and call the scratch variable x
, I get the same thing.
Is there any way to prevent this?
Upvotes: 1
Views: 52
Reputation: 9383
Naturally I discovered workarounds on my own almost immediately after posting the question. Each is a compromise that means losing a bit of functionality elsewhere, so pick your poison:
The bug seems to be that R# doesn't realize that, in this context, you are actually naming a new variable and instead applies its "where value is expected" behavior.
Upvotes: 1