resharper intellisense problem with extension methods

泪湿孤枕 提交于 2019-12-10 03:12:48

问题


so, I have a repository defined with a method like this:

IQueryable<Customer> Customers{...}

and elsewhere an extension method to filter the customers like so:

public static IQueryable<Customer> WithID(this IQueryable<Customer> customers, int ID){...}

and this woks nicely, letting me use the repository like this:

var c = repo.Customers().WithID(5).Single();

but the problem is, ReSharper messes up the Auto-Completion on this big time. When I type

var c = repo.Customers().Wi

I get nice Intellisense showing me the WithID(...) method, but when I cursor down to it and hit TAB, instead of getting the WithID() method as expected, it goes back and changes code already written and the line ends up looking instead like:

var c = CustomerExtensions.WithID(repo.Customers())

which of course leaves me having to go back and type it in again, and this time IGNORE intellisense - which IMHO is NEVER a good thing :)

I have confirmed that it is a ReSharper problem by going into options and specifying "Visual Studio" for Intellisense. I don't want to go back to plain Studio!

Can anyone help or suggest a workaround?


回答1:


This was affecting me as well. Looks like it's a known bug:

http://youtrack.jetbrains.net/issue/RSRP-274746

Turning off Resharper -> Options -> IntelliSense -> Completion Behaviour -> "Automatically insert parentheses after completion" helps.




回答2:


You can invoke it as an extension method by using type completion (CTRL + ALT + SPACE) and this will bypass the bug correctly.

This bug only happens for certain extension methods, don't know why though.



来源:https://stackoverflow.com/questions/4618742/resharper-intellisense-problem-with-extension-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!