The Actipro Blog

All the latest UI control development news from Actipro

SyntaxEditor for WPF Language Designer enhancements (part 8)

In the previous post of this series, the Language Designer generated some C# code for our ECMAScript language that can be used in your applications.  In today’s post we’re going to look at the other generation option, which is to output language definition files.

Generating a language definition file

By checking the “output a language definition” checkbox, our code files list changes to only show one file, a file with a .langdef extension.

LangDef1

The EcmaScript.langdef file is intended to be deployed with your application and loaded at run-time.  The nice thing about language definitions is that end users can tweak them as needed.  This is a lot trickier to do if you have dedicated C#/VB classes for your language. 

Let’s take a peek at what was generated…

LangDef2

If you are a SyntaxEditor for WinForms customer, you’ll see a similarity to the dynamic language XML definition format although some of the tag names are tweaked here.

The language definition file can be loaded in one line of code:

   1: editor.Document.Language = 
   2:     new SyntaxLanguageDefinitionSerializer().LoadFromFile(path);

There also is a LoadFromStream option that loads from any Stream, which is useful if you embed the .langdef file as an embedded resource in your application.

Next steps

We hope you have enjoyed our series on the Language Designer.  We’re currently finishing up some features in it and are converting over a bunch of language samples to the new language definition format before these updates can be released.  We hope to have it all wrapped up in the next several days.

Filed under: Actipro, In development, WPF

Comments (2) -

October 14, 2009 at 00:43  

CW United States

"The language definition file can be loaded in one line of code: ..."

Not that it matters that much, but that line isn't readable in IE 7. The scrollable code region is about 1/16" high (not counting the horizontal scroll bar).

October 14, 2009 at 13:52  

Bill Henning (Actipro) United States

Thanks for the note, we fixed the problem and updated it.

Pingbacks and trackbacks (1)+

Comments are closed