The beanshell is something that, I think, was specially engineered to support the JDE, and particularly the code completion stuff.  In JDEE, emacs starts up a Java VM and runs the beanshell class, in comint (command interpreter) mode.  Then emacs can send commands to this beanshell thing, commands like "Tell me what you know about the class named 'foo'". And the beanshell reflects on foo and returns the result, which would include public methods and properties, and so on.

In my last post i said that the CSDE basically copied all this stuff over and did a search-and-replace (s/java/csharp).  That's obviously not gonna work in general, and in particular with the beanshell.  But we do have this Powershell thing in .NET land, don't we?  Maybe you've heard of it.  And I already put together a working powershell comint mode for emacs.  

Just now I wrote a little TypeInfo class that exposes a single public static method, GetTypeInfo(). It uses reflection to list the members of a named class.  I can load that TypeInfo() class into Powershell and interrogate types like this:

  [System.Reflection.Assembly]::LoadFrom("c:\\dinoch\\dev\\dotnet\\TypeInfo.dll");

  [Ionic.Reflection.Utilities.TypeInfo]::GetTypeInfo("System.Data.SqlClient.SqlCommand",
                                  "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");

  [Ionic.Reflection.Utilities.TypeInfo]::GetTypeInfo("System.Xml.XmlReader",
                                  "System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");

  [Ionic.Reflection.Utilities.TypeInfo]::GetTypeInfo("System.DateTime",
                                  "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");

 

This is pretty much what beanshell does for JDE.  Now to figure out how to return the information in the way that CSDE can use it.

I know, I know.  I said I didn't want to write a code completion thing for C# in emacs.  But the various building blocks are all just sitting there, ready to be stitched together.  It's not far off. 

[ Update:  for the next installment in this drama, see the next post.]