Hi Ron,
Thank you for contacting Syncfusion Support.
The custom language can be configured in the EditControl by using the configuration file. By configuring the custom language in the EditControl, you can define the syntax coloring based on the requirement. The following steps help you to configure the syntax coloring for the Json language.
Step 1(Initialize the configuration language): Set the configured language by using the ConfigLanguage tag attribute.
For an example: <ConfigLanguage name="Json" StartComment="//" CaseInsensitive="true" >
Step 2(Extensions): Extensions contain a list of extensions that are associated with that particular language.
Step 3(Splits): Splits contain a list of expressions that must be treated as one word. “=” and “+” are splitters, by default. So, each of them are returned by the tokenizer as a single char. For example, when you want to specify a configuration for “+=”, you should specify “+=” in the splits section.
Step 4(Formats): This section helps you to initialize the Format strings. The Format assigns the syntax coloring for the keywords, text, comment tag, etc.
Step 5(Lexems): The Lexem contains rules for parsing the text. There are two attributes to specify the format of the lexem.
· Type: The Type is used for standard predefined types of the lexems.
· FormatName: The FormatName is used only when Type is Custom.
Step 6(AutoReplaceTriggers): The AutoReplaceTrigger option helps you to autocorrect the mistakes in the EditControl.
For an example:
<AutoReplaceTriggers>
<AutoReplaceTrigger From="slef" To="self" />
</AutoReplaceTriggers>
Step 7: After configuring the custom language, the configured file can be applied to the EditControl by using the Configurator.Open function in the EditControl.
Step 8: The text coloring of the specified language can be applied to the EditControl by using the ApplyConfiguration function in the EditControl.
For an example:
// Opens the PowerShell file.
this.editControl1.LoadFile(@"..\\..\\Sample.json");
//Configures the Custom Language File.
this.editControl1.Configurator.Open(@"..\\..\\Config.xml");
//Applies the Custom Language configuration to the EditControl.
this.editControl1.ApplyConfiguration("Json");
You can refer the below KB link for brief explanation of syntax highlighting for Custom Language Configuration.
KB Link:
We have prepared a sample to Parsing Json language in EditControl using above stepsfor your reference and you can download the sample and screenshots from the below link.
We request you to check with the above solution and let us know if it helps.
Regards,
Venkateshwaran V.R.