dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.96k stars 4.03k forks source link

Generic extension does not have lambda intellisense. #33469

Closed vsfeedback closed 1 year ago

vsfeedback commented 5 years ago

Then I do something like

string[] weekDays = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
weekDays.ForEach(wd => Console.WriteLine(wd));

On that first typing of wd, intelliesense gets confused and autocompletes with something it thinks is close but does not act like a normal lamda for a built in linq query. Super annoying.

Example extension

        public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action)
        {
            if (collection != null)
            {
                foreach (T item in collection)
                {
                    action(item);
                }
            }
        }

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/442247/generic-extension-does-not-have-lambda-intellisens.html VSTS ticketId: 782643 These are the original issue comments: (no comments) These are the original issue solutions: (no solutions)

sharwell commented 5 years ago

@dotnet/roslyn-ide One possibility here would be using the builder mode for completion of an argument when the method does not resolve to any overload with that name.

sharwell commented 5 years ago

In design review we agreed with the above proposal. Assigning to @dpoeschl since it may be a small fix on top of the work already done in this space.

CyrusNajmabadi commented 1 year ago

I don't repro this. The IDE is appropriately in 'suggestion mode' here:

image