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
close icon

Issue with writing a Custom language specification for Python


I'm trying to write a custom language specification for Python for the editControl.  I can do everything that I want to do, except one item.  The issue is the indentation for python as it doesn't happen between pairs of brackets.  A typical indentation in python looks like this:

def test():
     for i in range(10):

The code I'm using my config.xml file is shown below.  The issue is what do I put as the EndBlock as python doesn't have an endblock character?

 <lexem BeginBlock=":" EndBlock="????" Type="KeyWord" IsComplex="true" IsCollapsable="true" Indent="true" DropContextPrompt="true" 
          <lexem BeginBlock="\" IsBeginRegex="true" />

Thanks for your help.  

7 Replies

KP Kanniyappan Panneer Selvam Syncfusion Team November 23, 2019 06:23 AM UTC

Hi Gavin, 
Thanks for contacting Syncfusion support. 
The issue is the indentation for python as it doesn't happen between pairs of brackets 
The issue is what do I put as the EndBlock as python doesn't have an endblock character? 
We are currently checking on your queries at our end and updating the further details in two business days.  
If possible, can you please provide clear information about your requirement with an image illustration, it would help us to provide you with the solution as soon as possible. 
Kanniyappan P 

GA gavin November 23, 2019 03:37 PM UTC

I hope this explanation explains what I am trying to do.

I'm trying to find a way to perform auto indentation. The issue is described below:

"Most of the programming languages like C, C++, Java use braces { } to define a block of code. Python uses indentation.
A code block (body of a functionloop etc.) starts (in python) with indentation and ends with the first unindented line. The amount of indentation is up to you, but it must be consistent throughout that block."

I can start the block fine.  All blocks start with a ":" eg:

def test():   
     print("hello world")  

The problem is how do I indicate an end of block, so that the auto indentation stops, as the end of block is signalled by an unindented line rather than a symbol such as '}'


KP Kanniyappan Panneer Selvam Syncfusion Team November 25, 2019 07:32 AM UTC

Hi Gavin, 
Thanks for your update. 
Currently EditControl does not have support to achieve your requirement “Define dynamic BeginBlock and EndBlock based on python language”. So, we will consider to provide built-in support Python language in future and logged a feature request for “Provide built-In support for python language in EditControl” and it can be tracked through our feedback portal below. We will implement this feature in any of our upcoming release.  
Please cast your vote to make it count. We will prioritize the features every release based on the demands.  
If you have any more specification/suggestions to the feature request you can add it as a comment in the portal.  
Kanniyappan P 

SN surbhi nahta May 4, 2020 10:42 AM UTC


I was having the same issue for Python and couldn't find the solution till yet. but now i think this will work.

UN Unknown Syncfusion Team May 4, 2020 11:48 AM UTC

Hi Surbhi, 

Thanks for your update. 

We will wait to hear from you.  

Niranjan Kumar Gopalan 

FJ Florene J Anderson September 24, 2020 11:14 AM UTC

Thank you for such a valuable information. I was looking for a long time detailed explanation. Really appreciate your reply!

UN Unknown Syncfusion Team September 25, 2020 04:55 AM UTC

Hi Florene, 

We are glad to be of assistance. 

Niranjan Kumar Gopalan 

Live Chat Icon For mobile
Up arrow icon