Bug 2542 - Mono.CSharp.Evaluators.GetCompletions() doesn't return extension methods
Summary: Mono.CSharp.Evaluators.GetCompletions() doesn't return extension methods
Status: NEW
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2011-12-16 14:16 UTC by Patrick Smacchia
Modified: 2015-11-06 10:25 UTC (History)
2 users (show)

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


Attachments
The extension method Where() should be matched (209.53 KB, image/jpeg)
2011-12-16 14:16 UTC, Patrick Smacchia
Details


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 for Bug 2542 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Patrick Smacchia 2011-12-16 14:16:22 UTC
Created attachment 1060 [details]
The extension method Where() should be matched

I use the most recent Mono.CSharp downloaded today 16th of December 2011 from Github.

See the 2 screenshots attached.
In the left one the extension method Where<T>(this IEnumerable<T> ) should be matched by GetCompletions().
The right screenshot proves that the evaluator context knows the method Where(), since it recognizes that i is an integer.

On a side note, could it be possible to get a GetCompletions() method that would returns something more precises than just strings, like members or types metadatatokens + their parent assemblies for example?

Btw, congrat for this awesome piece of code :)

----------------------------------------------------------
The source code:

using System;
using Mono.CSharp;
namespace ConsoleApplication1 {
   class Program {
      static void Main(string[] args) {
         var report = new Report(new ConsoleReportPrinter());
         var cmd = new CommandLineParser(report);

         var settings = cmd.ParseArguments(args);
         if (settings == null || report.Errors > 0) { Environment.Exit(1); }

         var evaluator = new Evaluator(settings, report);

         //evaluator.LoadAssembly("System.Core");
         evaluator.Run("using System.Linq;");
         evaluator.Run("using System.Collections.Generic;");
         evaluator.Run("IEnumerable<int> Ints;");
         string prefix;
         var propositions = evaluator.GetCompletions(@"Ints.Whe", out prefix);

      }
   }
}