We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

EditControl: Ignore lexems preceded by dot


I am working on a custom Intellisense solution for a Python script editor.  For each public class in our API a ConfigLexem is created, which works fine for text highlighting in most circumstances.  The known class names turn light blue in the editor, similar to Visual Studio.

However, there are many situations where a property of some object happens to have the same name as an existing class, and this is being incorrectly recognized as the class name.


class Contact 

class Employee, has string property called Contact which has nothing to do with the above class

Sample Code:

emp = Employee()
emp.Contact = False  <-- this is recognized as the class 'Contact' and colored as a class name!

I have tried using lookbacks in regular expressions (e.g. lexem.IsBeginRegex = true) but they do not work, as it seems the words have already been stripped and do not contain information about the preceding characters by the time they go through the regex engine.

If there is a dot in front of the class name, it should not be recognized as the class.

Is what I am trying to achieve possible with this system, or do I need to make a second pass over the editor contents and somehow undo some of the highlighting?


5 Replies

KR Kannan R Syncfusion Team June 9, 2015 05:26 AM UTC

Hi Thomas,


Thank you for using Syncfusion products.


We would like to let you know that, this reported requirement can be achieved by using Splits configuration in EditControl. Please find the detailed explanation below.


In EditControl, its content will be split based on Special characters.


For example:


If the content is given as “this.EditControl1”, then it will be split and considered as 3 individual words.

1)      this

2)      .

3)      EditControl1


For this case, Splits concept in EditControl can be used to combine desired contents as common one, “this.EditControl1” as a word. We request you to refer with the below code snippet.


Code Snippet: [C#]



<!--To combine special character with the keyword-->




UG Link: http://help.syncfusion.com/ug/windows%20forms/index.html#!Documents/creatingacustomlanguageconfigurationfile.htm                          


Once, if “.public” is loaded in EditControl, public will not be highlighted as keyword. As like this, user will be able to create splits word based on the user requirement. We have also prepared a screen shot and sample by considering “public” and “class” keywords for your reference and it can be downloaded from the below location.


Screen shot:




Sample Location: http://www.syncfusion.com/downloads/support/forum/119331/ze/EditControl_KeywordSplit1504159238                        


We request you to check with above solution and let us know if it helps.


Please let us know if you need any further assistance,




TL Thomas Langley June 9, 2015 07:44 PM UTC

Hello Kannan,

Thank you for this information.  It looks like a step in the right direction; however, I need dynamic behavior and it seems the splits do not work when they are added after the text of the control has been set.

For example, a user may type a new import statement in the script, and my program will search the imported namespace and add classes/splits for highlighting.  This currently works with adding lexems but not splits!

In the sample solution, I added a few lines to the constructor to demonstrate:

  public Form1()

            this.Text = "EditControl";        

            // Add split and lexem for TEST2

            //this.editControl1.Language.Splits.Add(new Split(".TEST2"));     // this works
            this.editControl1.Language.Splits.Add(new Split(".TEST2"));   // this does not work, after file is loaded
            var lexem = new ConfigLexem("TEST2", "", Syncfusion.Windows.Forms.Edit.Enums.FormatType.KeyWord, false);



Is there an easy solution to this problem?


KR Kannan R Syncfusion Team June 10, 2015 11:34 AM UTC

Hi Thomas,


Thank you for your update.


Yes, In EditControl, custom configuration settings need to be initialized before loading its contents. Hence, if end user like to update this settings dynamically, it will be needed to re-apply the configuration once changes are done, by using its function named ApplyConfiguration. Please make use of below code snippet for your reference.


Code Snippet: [C#]


// To re-apply the configuration




We have also prepared sample for your requirement and it can be downloaded from below location.


Sample Location: http://www.syncfusion.com/downloads/support/forum/119331/ze/EditControl_Modified-1557382824        


Please let us know if you need any further assistance,




TL Thomas Langley June 10, 2015 05:13 PM UTC

Hi Kannan,

Thank you very much for your help.  It is working nicely, and I realize now that the IsRegex option makes things even easier!


AJ Ashwini Jaya Preetha Durai Samy Syncfusion Team June 11, 2015 08:43 AM UTC

Hi Thomas,

Thank you for your update.

We are glad that we have helped you on this.

Please let us know if you need any further assistance,


Live Chat Icon For mobile
Up arrow icon