We developed a custom VS-like code editor for VB.NET. The editor uses Actipro Syntax
Editor as the text editor and does the lexical and syntactical parsing of the code
using ANTLR. A custom CodeDom tree, which is similar yet more comprehensive than
the MS Code Dom, is generated during the code parsing. Then, using this CodeDom
tree, most of the VS Code Editor’s features are executed.
Components
Editor
The editor supports
- Intellisense:
- Member listing after special characters and upon request via Ctrl-Space
- Parameter information on invocation statements.
- Word filtering and completion while writing code with respect to current context.
- QuickInfo for displaying signature of the members and variables using tooltip when
mouse comes over a word.
- Auto-Complete:
- Automatic insertion of code segments for method and property declarations as well
as compound statements such as the If, While, Try-Catch and For statements.
- Code Navigation:
- Navigation toolbars simplify the navigation through the methods and events.
- Code Generation:
- Automatic event generation when an event selected from the navigation toolbar is
not handled.
- The signature of an event is generated using the internally developed custom CodeDom
tree.
The code written in this editor is ultimately compiled into a dll which is executed
in an ASP.NET web context as an event or an action method.
We also created an Object Browser to browse the contents of generated dll files.
Parser
ANTLR was selected and used for parsing VB.NET code. Since there was no native support
for VB.NET code in either ANLTR or Actipro component, all the grammar was written
from scratch consistent with VB.NET Language Specification. New language elements
such as the generics were supported as they are released.
CodeDom
Similar to, but more comprehensive than the MS CodeDom, is used as a code block
tree that holds crucial information for Intellisense. Every type, type member, statement
and expression has corresponding classes created from the parser. Type and type
member classes are also used to hold information about built-in .NET classes, which
are obtained through reflection, to aid Intellisense.
GAC Iterator
A simple tool to get the assembly, namespace, type, and member information for assemblies
located in the Global Assembly Cache.
Code Generator
Used by the Code Editor to generate event handlers as they are selected from the
navigation toolbar, this tool generates code for every code block in CodeDom tree.
Object Browser
This is a CodeDom tree browser, which is very similar to Visual Studio’s built-in
Object Browser, and shows assemblies, namespaces, types and type members and their
parameters in a separate window in the main application IDE.
Technologies Employed
- .NET Languages: Both VB.NET and C#
- Windows Forms
- Reflection
- XML Serialization
- Multithreading