Search code examples
c#visual-studiolinqintellisenseextension-methods

How to remove LINQ extension methods from Intellisense?


Basically I want the opposite of this question: Intellisense stopped working for Linq to Entities

This is driving me mad since I downloaded VS 2022 and upgraded my projects to .NET 7

VS is placing using System.Linq in every file I create. I'm deleting this line. Sometimes it stops showing me the methods for a minute but then it starts to show them back, even there is no using ... . Whenever I implement IEnumerable the list is bloated with useless methods that distract me from work and slow me down...

For example I have a List<Path> (geometry) and I want extract sub range of it. I type ".sub" and the only entry showed in the list is Sum<T>(Func<T, decimal>...), instead of proposing GetRange(int, int) (which is the name I forgot) and it takes a lot of time to find a method manually in such a big list. Doesn't feel very "Intelli" to me...

Why is this so intrusive and how do I stop it?

I tried removing using statements in file and unchecked "Implicit global usings" in project settings.


Solution

  • Works for me, although probably because I have installed (not sure how it looks without).

    Popup window

    The extension methods are listed after all the other methods, so searching is easier. Also, the small buttons at the bottom allow to filter by type. Left-clicking on the "Extension method" icon (the one with the down-arrow) shows only these, right clicking hides them. The choice is remembered between usages of the dropdown.

    To hide suggestions from non-included namespaces (including linq extensions methods), but generally keep showing extension methods, there's an option under Options -> Text Editor -> C# -> Intellisense -> Show Elements from non-included namespaces.