Providing syntax editor within a .net application

by Miha Markič 20. October 2008 22:46

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):

image

Tags:

Comments (3) -

André
André
10/28/2008 3:34:04 AM #

Hello Miha

Could you explain your Tool 'Righthand's LLBLGenPro Query Studio'? Where can i get it?

Reply

Miha Markic
Miha Markic
10/28/2008 12:02:05 PM #

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 Smile

Reply

André
André
10/29/2008 10:57:56 PM #

It looks great Wink

I am looking forward to see this tool!

André

Reply

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Miha Markic

About me
Righthand
 
Microsoft MVP
 
Developer Express' DXSquad
INETA Country Leader for Slovenia
INETA Country Leader for Slovenia

Slovene Developer Users Group Lead
Friends of Red-Gate
LLBLGenPro Partner

Miha currently works as a free lance consultant and software developer specialized in .net area.
He graduated in Computer and information science at the University of Ljubljana, Slovenia. He has accumulated experience in various programming languages such as Java, Visual Basic 3-6 (MCP), Visual C++, Delphi, C# and VB.Net through years.
He has experience in practically all (technical) stages of project development, including planning, framework development, user interface, business processes, as well as testing and documenting. He has worked on big and small projects in Slovenia and abroad (e.g. participated in completing level 3 IS for the Nucor steel plant, Hertford, USA).
Currently he enjoys programming in .net environment using C#. Since 2000 he has been active in Developer Express' DX Squad and has been ECDL trainer and tester. He also gives lectures on conferences and other events in Slovenia.

Month List

Tag cloud

Most comments

Paulius Paulius
1 comments
us United States
Meh Meh
1 comments
us United States
bart dm bart dm
1 comments
nl Netherlands

RecentComments

Comment RSS