Bug 4483 - Completion too aggressive for anonymous methods
Summary: Completion too aggressive for anonymous methods
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: Trunk
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-04-17 16:36 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2012-04-18 13:47 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Rolf Bjarne Kvinge [MSFT] 2012-04-17 16:36:36 UTC
This is one annoying thing both VS and MD have in common, I hope MD can be better here :)

Repro:

You want to type:

Action action = v => { Console.WriteLine ("foo"); };

the issue is the space after 'v', it ends up like this:

Action action = var 

This sample is a bit uncommon, but it happens all the time when I want to pass anonymous delegates as parameters in function calls.
Comment 1 Mike Krüger 2012-04-17 17:11:24 UTC
in fact we had a solution for that :)

But it got broken - I don't know when we had it, it may be back in the 2.2 area ?
It didn't work for all cases because the context lookup was very, very hard to do with the old nrefactory.

But now I can improve on that again :). I'll put it on the tomorrows todo pile.
Comment 2 Mikayla Hutchinson [MSFT] 2012-04-17 18:54:58 UTC
I think we fixed that sometime in the 2.6 cycle (which lasted about a year), it must have regressed in newresolver.

Basically, in the case where completion was expecting a delegate - event add/remove, delegate parameters, delegate variable assignment - we would switch completion into "suggestion" mode, and also offer several suggestions for lambda and anonymous method patterns, as well as methods in scope that matched the delegate signature.
Comment 3 Mike Krüger 2012-04-18 01:12:35 UTC
it worked only for a few contexts since real context lookup wasn't possible there.
Comment 4 Mike Krüger 2012-04-18 13:47:21 UTC
fixed that one - it should work in many more contexts.

For example:

List<Action> act = new List<Action> ();
act.Add (v