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.Data, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089”);
“System.Xml, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b77a5c561934e089”);
“mscorlib, Version=126.96.36.199, 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.]