[Journal - Auto-Completion for .NET Console]

Auto-Completion for .NET Console

Saturday, April 16, 2005

WebEdit.NET now provides some rudimentary form of IntelliSense for commands of the "code:" protocol when entered in the Console window. To be more specific, there is an AutoText list:

The expression in question can be an argument to a method call as well.

Now, the bad news is that .NET console is a dynamic interpreter. It obtains the members lists only after evaluating previous parts of the expression, so you get all the members of an object, not just those obtainable from the type information available. Parsing and evaluation are tightly coupled, which is bad. The result is, if you use AutoText - you can bring up the list by pressing Ctrl+Space - the expression is partially evaluated as you type. So take side effects into account.

All in all, the member lists are not 100 per cent reliable, because of the pitiful parsing capabilities of .NET Console. Providing IntelliSense is not an easy task, but I think in the case of a simple expression evaluator like .NET Console, if I manage to write a proper parser some day, I should be able to produce something reasonable. After all, there is just one statement to parse, and all the meta data comes from .NET assemblies which are easy to reflect against.