How to stop R# 9 from inserting Enumerable...for extension methods?

Whenever I get the list of suggestions of extension methods and choose something like Count(),  my enumerable/queryable linq statement gets converted into Enumerable.Count(...). This behavior is new in version 9. How do I turn this behavior off?

9 comments
Comment actions Permalink

Sounds like the same problem I'm seeing:
https://devnet.jetbrains.com/message/5530259?tstart=0
https://youtrack.jetbrains.com/issue/RSRP-428931

For me, it only seems to happen if the class contains an instance method with the same name as the extension method. Are you seeing the same, or do you always get the static-method version for every extension method?

0
Comment actions Permalink

Do you mean in my example do I have a count() extension menthod for the class? I don't know. How do I do a quick search for where extension methods are defined for the class?

0
Comment actions Permalink

I've only seen this when there's an instance method and an extension method with the same name - R# 9 completes the extension method call as a static method call.

I think yours might be a separate issue - when you have an IQueryable<T> object, R# 9 is suggesting extension methods from the Enumerable class before the Queryable class. When you accept the completion from the Enumerable class, it has to be completed as a static method call, since an extension method call would call the method from the Queryable class.

It's still a bug, but it's a subtly different bug to the issue I reported.

0
Comment actions Permalink

I've reported the problem with the order of the auto-complete list as RSRP-429120.

0
Comment actions Permalink

I see an assignee but other than that I don't see they are acknowledging it as a bug? Did they?

0
Comment actions Permalink

They haven't updated it yet, but I only reported it a few hours ago.

If it's the same issue you're seeing, feel free to vote for it!

0
Comment actions Permalink

So you reported two different bugs? Are they the same issue? The first one mentions a fix in 9.1

0
Comment actions Permalink

No, they're subtly different issues. The first one relates to extension methods where there is an existing instance method with the same name. The second one relates to the ordering of extension methods in the auto-complete list.

0
Comment actions Permalink

What's the status of this bug? It's still in R#9 update 1. As soon as I type the character '(' in for example SingleOrDefault(), it automatically converts the linq statement to Enumerable.SingleOrDefault(.... I have to hit ctrl-Z to revert it. I am not even selecting anything from the autosuggest list.

0

Please sign in to leave a comment.