扩展方法的 resharper 智能感知问题
所以,我有一个用这样的方法定义的存储库:
IQueryable<Customer> Customers{...}
在其他地方有一个扩展方法来过滤客户,如下
public static IQueryable<Customer> WithID(this IQueryable<Customer> customers, int ID){...}
所示:这很好,让我可以像这样使用存储库:
var c = repo.Customers().WithID(5).Single();
但问题是,ReSharper搞乱了自动完成在这个重要的时刻。当我输入时,
var c = repo.Customers().Wi
我得到很好的智能感知,向我显示 WithID(...) 方法,但是当我将光标向下移动并按 TAB 键时,它没有按预期获取 WithID() 方法,而是返回并更改已编写的代码和该行最终看起来像:
var c = CustomerExtensions.WithID(repo.Customers())
这当然让我不得不返回并再次输入它,这次忽略智能感知 - 恕我直言,这从来都不是一件好事:)
我已经通过进入选项确认这是一个 ReSharper 问题并为 Intellisense 指定“Visual Studio”。我不想回到普通的工作室!
任何人都可以提供帮助或建议解决方法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这也影响了我。看起来这是一个已知错误:
http://youtrack.jetbrains.net/issue/RSRP-274746
关闭重新磨刀->选项->智能感知 ->完成行为 -> “完成后自动插入括号”有帮助。
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.
您可以使用类型完成(CTRL + ALT + SPACE)将其作为扩展方法调用,这将正确绕过该错误。
这个错误只发生在某些扩展方法上,但不知道为什么。
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.