Providing syntax editor within a .net application

Many times I’ve incorporated some sort of scripting capabilities into my .net applications. Usually I’d let user to type in some C# code and then I’d take that code, compile it in memory in another AppDomain (to avoid memory hogging) and execute it when required. Or in other occasions I’d let user type some SQL code and later use it to execute a T-SQL command or against the database. The C# feature provides some challenges while the SQL feature is pretty straightforward. The weak point in both feature implementations is the lack of syntax coloring control or even better, intellisense, error underlining and other nice stuff we are used from Visual Studio. In other words if one wants to do it with style a proper syntax editor is required. Creating such a control by myself would be a complex task and without unlimited time at my disposition it’d be a mission impossible.

That’s why I’ve bought Actipro‘s Syntax Editor for WinForms (and no, other platforms aren’t supported right now, WPF being in development AFAIK). The core Syntax Editor is a huge beast in positive sense. It supports all sort of editor features one would expect. Its language definition is dynamic, meaning that you can create support for whatever language you want through an XML definition or, if you require additional features, through an add-on which is written in .net. You most probably won’t need to, because many definitions come out of the box, such as “Assembly, Batch files, C#, CSS, HTML, INI files, Java, JScript, Lua, MSIL, Pascal, Perl, PHP, PowerShell, Python, SQL, VB.NET, VBScript, and XML“, but it is nice to have an open definition.

If you are serious about providing editing support for either a .net language (C# and VB.NET) or XML language then you have an option to buy an add-on that extends the support even further. With such an add-on the Syntax Editor really starts to shine with IntelliPrompt, syntax error display, reflection and metadata cache of referenced assemblies, etc. Similar features are provided with XML add-on, once you provide matching XSD. I won’t go in the details since this stuff is all over Actipro‘s web pages. Worth to remember is the fact that both .net and XML add-on are a separate products. If you don’t want to buy them you are actually free to create such add-ons by yourself, too. There is even a sample of a simple add-on.

The learning curve is steep but there is documentation to help, a huge (but readable and good) sample that demonstrates various features and a responsive support forum. Support is good, they quickly fix the errors and include the fix in the next minor version. I actually stumbled upon few errors (no wonder there are error in such a big product) which were quickly fixed. If you are interested in what Actipro is doing or explanations you might check their blog as well.

All in all Syntax Editor is a feature rich, easy to use, flexible and expandable syntax editor worth looking at. It is actually very easy to use most important of its capabilities writing just a bunch of lines of code. If you are interested in the product then there is no better way than to check it by yourself – go download their time limited full trial version.

Ah, and here is Syntax Editor in action in my Righthand’s LLBLGenPro Query Studio (application in-development):


3 thoughts on “Providing syntax editor within a .net application

  1. Hi,

    The “super secret in development” tool is still being developed. I’ll announce some sort of preview version once it is ready.
    Glad to know that there is intereset 🙂

Leave a Reply