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

Context menu comment option

Hi

I've developed a custom language lexer for the edit control which works well.

However, I'm now trying to use the context menu options.  Most of them work as expected.  However, the comment / uncomment options don't  appear to do anything.

I cannot find anywhere in the documentation how you set what should happen when the comment line / comment selection options are chosen from the editcontrol's built in context menu.

Can anyone explain how you set what should happen when these options are clicked.

Thanks

Gavin

8 Replies

NK Niranjan Kumar Gopalan Syncfusion Team December 6, 2019 08:01 AM

Hi Gavin, 
 
Thanks for contacting Syncfusion support. 
 
We are currently analyzing your query regarding “Comment and uncomment options don't  appear to do anything” and we will update you on December 10th 2019. 
 
 
Regards, 
Niranjan Kumar 
 



NK Niranjan Kumar Gopalan Syncfusion Team December 10, 2019 08:35 AM

Hi Gavin, 
 
Thanks for your update. 
 
We have analyzed your query regarding ”Comment and UnComment option in context menu not working” . The comment and uncomment option doesn’t work for default language. For C-Sharp codes we have provided the code snippet and simple sample required to achieve your criteria. 
 
C#: 
 this.editControl1.ApplyConfiguration(Syncfusion.Windows.Forms.Edit.Enums.KnownLanguages.CSharp); 
 
 
Regards, 
Niranjan Kumar 



GA gavin December 11, 2019 04:49 AM

Niranjan

I'm sorry but that doesn't work for me.  I want to apply a specific set of comment characters for my own custom language, not use the comment characters that are associated with c#.

Gavin


NK Niranjan Kumar Gopalan Syncfusion Team December 12, 2019 08:19 AM

Hi Gavin, 
 
Thanks for your update. 
 
We are currently analyzing you query “Want to apply a specific set of comment characters for my own custom language”. Can we know details regarding whether the language that you are using comes under known languages and whether only the comment and uncomment options in context menu does not work for your custom language and other options works properly? 
 
Regards, 
Niranjan Kumar 



GA gavin December 12, 2019 10:06 AM

I'm writing a python editor, so all lines when commented should have a '#' in front of them. 
The other items in the context editor work fine.

Your documentation suggests that the editor can be used for an arbitrary language, so I'd assumed that you could set the comment characters somewhere.

Thanks



NK Niranjan Kumar Gopalan Syncfusion Team December 13, 2019 05:31 AM

Hi Gavin, 
 
Thanks for your update. 
 
We have analyzed your query “Comment and UnComment option in context menu not working”. To enable the comment and uncomment actions please do the below changes in you config.xml file.  
 
C#: 
At the initialization of config language enable StartComment property by assigning your comment prefix string. 
<ConfigLanguage name="Python" StartComment="#" > 
Lexem with type comment should be added inside the lexems. 
<lexems> 
 
                <lexem BeginBlock="(" Type="Operator" /> 
 
                <lexem BeginBlock=")" Type="Operator" /> 
 
                <lexem BeginBlock="'" Type="Operator" /> 
 
                <lexem BeginBlock="car" Type="KeyWord" /> 
 
                <lexem BeginBlock="cdr" Type="KeyWord" /> 
 
                <lexem BeginBlock="cons" Type="KeyWord" /> 
                                                             
               <lexem BeginBlock="#" EndBlock="" IsEndRegex="true" Type="Comment" IsComplex="true" OnlyLocalSublexems="true" /> 
 
</lexems> 
 
Please refer the below sample and video for your query. 
 
 
 
Regards, 
Niranjan Kumar 
 



GA gavin December 13, 2019 11:26 AM

Many thanks

That works great

Gavin 


SN Sudharsan Narayanan Syncfusion Team December 16, 2019 01:39 AM

Hi Gavin, 
 
Thanks for you update.  
 
We are glad to know that the reported issue has been resolved at your end. Please let us know if you need any further assistance on this. We are happy to help you.  
 
Regards,  
Sudharsan N 


Loader.
Live Chat Icon For mobile
Up arrow icon