Issues with lexem for powershell

Hi,

i'm trying to implement syntax highlighting for powershell in the syntax editor but I'm having issues with my lexem.

Attached is what I've achieved so far.

In my case inly lexem for comments, variables and only "begin" "process" and "end" keywords are working.

What I've done is based on the python sample provided in the doc and I really can't figure out what isn't working.


Attachment: CodeBehindEditor_b4ed74fc.zip

3 Replies

KR Kannan R Syncfusion Team September 17, 2018 07:11 AM UTC

Hi Mickael, 
 
Thank you for contacting Syncfusion Support. 
 
We have checked your query “Keywords are not highlighting using Powershell Language. It is needed to define the FormatName for Keyword as “KeyWordFormat”. But you have defined the Format name incorrectly like “KeywordFormat“ (except begin, process and end). So, those keywords were not highlighting. We have corrected and it is working fine. Please refer the below Screenshot. 
 
 
 
 
Please try this above solution and let us know if it is helpful. 
 
Regards, 
Kannan 



MP Mickael Ponsot September 17, 2018 09:06 AM UTC

Oh, of course it work much better now !

The only execption is for the cmdlet matching lexem :

<syncfusion:Lexem StartText="\w+-\w+" IsRegex="True" IsMultiline="False" ContainsEndText="False" LexemType="Keyword" FormatName="KeywordFormat"/>

This one still cannot recognize powershell cmdlets such as test-path


KR Kannan R Syncfusion Team September 18, 2018 10:53 AM UTC

Hi Mickael, 
 
Thanks for your update. 
 
We have checked your updated code, you have setting the  “- [minus]” sign as operator. So, this [word-word] Keyword format was not highlighting. Because “-“ sign will be considered as individual operator and Syntax highlighting was not applied.  It is needed to remove “-“ operator code.  
 
Screenshot 
 
 
 
Modified sample: PowershellSample 
 
Please try this above sample and let us know if it is helpful. 
 
Regards, 
Kannan 


Loader.
Up arrow icon