# TEXTEDITOR NOT PARSING/HIGHLIGHTING

**URL:** <https://forum.alternetsoft.com/t/texteditor-not-parsing-highlighting/130>\
**Category:** AlterNET Studio Support\
**Tags:** wpf, editor\
**Created:** [February 14, 2019, 12:00am UTC](https://forum.alternetsoft.com/t/texteditor-not-parsing-highlighting/130 "2019-02-14T00:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke.buckley](https://forum.alternetsoft.com/letter_avatar_proxy/v4/letter/l/606060/32.png) [@luke.buckley](https://forum.alternetsoft.com/u/luke.buckley)\
**Post date:** [February 14, 2019, 12:00am UTC](https://forum.alternetsoft.com/t/texteditor-not-parsing-highlighting/130/1 "2019-02-14T00:00:00Z")

</div>

Hi there,  
I'm getting started with the WPF syntax editor for a simple custom language we use. I've created a class inheriting from SyntaxParser and overridden the Outline method so it does region outlining for our language keywords - this works fine.   
However the TextEditor is not applying any highlighting to the script. Right now I'm just loading the c#.xml scheme file that came with your demos, and my plan is to just copy it and edit it down to what I need. However when I type "class" or any other C# keyword it fails to highlight in the editor.   
So, I am either missing something in my config, or in my parser implementation. My hope was to just use a custom parser for the region outlining and an xml file for the keywords and basic syntax highlighting.  
What am I missing?  
Here is my code below (I'm excluding the Outline implementation for brevity, as I assume that doesn't affect this)  
public XParser()  
 {  
 Options = SyntaxOptions.Outline;  
 var fileInfo = new FileInfo(@"C:\..path to..\c#.xml");  
 if (fileInfo.Exists)  
 this.Scheme.LoadFile(fileInfo.FullName);  
 }  
And in my main method:  
 public MainWindow()  
 {  
 InitializeComponent();  
 Parser parser1 = new XParser();  
 var sb = new StringBuilder();  
 sb.AppendLine("#for x in y");  
 sb.AppendLine("");  
 sb.AppendLine("#endfor");  
  
 TextSource textSource2 = new TextSource();  
 textSource2.Lexer = parser1;  
 textSource2.Text = sb.ToString();  
 edit.Source = textSource2;  
  
 edit.AllowOutlining = true;  
 edit.AllowDrop = true;  
 edit.Outlining.OutlineOptions = OutlineOptions.DrawLines | OutlineOptions.DrawButtons;  
 edit.LineNumbersVisible = true;  
  
 }  
Thanks,  
Luke.

---

<div class="post-metadata">

**Author:** ![andrew.medvedev](https://forum.alternetsoft.com/user_avatar/forum.alternetsoft.com/andrew.medvedev/32/28_2.png) [@andrew.medvedev](https://forum.alternetsoft.com/u/andrew.medvedev)\
**Post date:** [February 15, 2019, 12:00am UTC](https://forum.alternetsoft.com/t/texteditor-not-parsing-highlighting/130/2 "2019-02-15T00:00:00Z")

</div>

Hi,  
For the parsers derived from SyntaxParser you will need to set UseScheme property to true to use syntax scheme:  
public XParser()  
 {  
 UseScheme = true;  
 ...  
 }  
Otherwise you will need to implement lexical analysis manually, which gives better performance comparing to one based on syntax scheme, but requires some work - we can send you an example how this can be done if needed.  
Hope this helps.  
regards,  
Andrew

---

<div class="post-metadata">

**Author:** ![luke.buckley](https://forum.alternetsoft.com/letter_avatar_proxy/v4/letter/l/606060/32.png) [@luke.buckley](https://forum.alternetsoft.com/u/luke.buckley)\
**Post date:** [February 15, 2019, 12:00am UTC](https://forum.alternetsoft.com/t/texteditor-not-parsing-highlighting/130/3 "2019-02-15T00:00:00Z")

</div>

Thanks Andrew! That solved it.
