Notepad++ Rules syntax highlight

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Notepad++ Rules syntax highlight

#1 Post by grovkillen » 12 Mar 2018, 12:52

I have started on a highlight file for Rules using the text editor Notepad++.

Please feel free to contribute or use. It's the UDL file that you import into Notepad++

https://github.com/Grovkillen/ESP_Easy_ ... adPlusPlus
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Notepad++ Rules syntax highlight

#2 Post by budman1758 » 12 Mar 2018, 18:45

Just tried to import that. Using the "user language editor" import function and all I got was "import failed"
Am I going about it wrong? (very possible) :?:
"The glass is twice as big as it needs to be".

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Notepad++ Rules syntax highlight

#3 Post by vader » 12 Mar 2018, 19:14

Have you tried to rename the file to 'ESP_Easy_rules.xml'? After import you have the new option like this...
Attachments
2018.03.12 19-30-42.png
2018.03.12 19-30-42.png (2.36 KiB) Viewed 12624 times
Last edited by vader on 12 Mar 2018, 19:33, edited 1 time in total.

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Notepad++ Rules syntax highlight

#4 Post by budman1758 » 12 Mar 2018, 19:24

vader wrote: 12 Mar 2018, 19:14 Have you tried to rename the file to 'ESP_Easy_rules.xml'?
No. But I will now. :D
"The glass is twice as big as it needs to be".

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Notepad++ Rules syntax highlight

#5 Post by budman1758 » 12 Mar 2018, 19:39

Found the problem. Instead of downloading the zip file from git I just right clicked the udf file and chose save as. :oops:
Downloaded the zip and it worked fine.

This is a great addition. Kudos!!
"The glass is twice as big as it needs to be".

User avatar
micropet
Normal user
Posts: 34
Joined: 23 Jan 2018, 11:39
Location: Essen, Germany
Contact:

Re: Notepad++ Rules syntax highlight

#6 Post by micropet » 12 Mar 2018, 20:46

Fine! Thank you

Peter

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Notepad++ Rules syntax highlight

#7 Post by grovkillen » 12 Mar 2018, 21:08

Great to see that you find it useful.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Notepad++ Rules syntax highlight

#8 Post by grovkillen » 13 Mar 2018, 10:08

Updated with more operators and AND/OR tests.

https://github.com/Grovkillen/ESP_Easy_ ... adPlusPlus

Renamed the ext to XML.. sorry for the mistake :)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

pverburg
New user
Posts: 2
Joined: 14 Apr 2017, 04:50

Re: Notepad++ Rules syntax highlight

#9 Post by pverburg » 21 Aug 2018, 04:59

Thanks for doing this saved me lots of time i started reading the instructions to make the file and got lost, one issue if the letters "on" are in a variable or event name they get highlighted.

Yours,
Paul V.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Notepad++ Rules syntax highlight

#10 Post by grovkillen » 21 Aug 2018, 12:12

I've looked into this and the UDL2 engine is not that great. So it's either the "on" or the "if" that will be interpreted as code by the code folder. I wish I could use regex to make the highlighting better but until Notepad++ releases the UDL3 engine we're pretty much left on our own.

BUT this is why I plan to make an "IDE" for the rules that will let you do this inside the GUI of the unit.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: Notepad++ Rules syntax highlight

#11 Post by Patou » 03 Nov 2021, 23:02

Hello Grokvillen,
Hope you are still with us ....
I installed on a new computer the latest notepad++ 8-1-9
I used the esp easy language on my previous computer and found it very usefull. (disk crash and dead!)
Downloaded the zip file on github and change it to .xml but the import failed.
Is this version of the xml file too old ?
Thanks in advance for your answer
Patou

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Notepad++ Rules syntax highlight

#12 Post by TD-er » 04 Nov 2021, 00:21

I just downloaded the XML file from Jimmy's GitHub page: https://github.com/Grovkillen/ESP_Easy_ ... adPlusPlus
Saved it into the folder which opens if you select to load a user defined language folder.
See the screenshot to show it is working

It may need some update to add keywords introduced since the last update of this file.
Attachments
2021-11-04 00_18_32-_new 28 - Notepad++.png
2021-11-04 00_18_32-_new 28 - Notepad++.png (29.75 KiB) Viewed 6746 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Notepad++ Rules syntax highlight

#13 Post by TD-er » 04 Nov 2021, 01:27

Just made a PR for updating to all currently known commands and events.
https://github.com/Grovkillen/ESP_Easy_ ... lus/pull/1
You can of course already fetch that XML file for testing.

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: Notepad++ Rules syntax highlight

#14 Post by Patou » 04 Nov 2021, 11:53

Hello
It works my file was corrupted !!
Please note the new language appears after you reopen the program
Thanks
Patou

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: Notepad++ Rules syntax highlight

#15 Post by Patou » 04 Nov 2021, 20:03

Hello
I have extended the work of Grokvillen with all the commands present actually in the doc.
General commands and plugin specific commands have different colors.
I am not familiar with the Github update of files.
So please find in attachment the new .xml file.
Please double check and publish it to Github.
Thanks for the important and super quick support.

https://drive.google.com/file/d/1GjP-ok ... sp=sharing

Patou

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Notepad++ Rules syntax highlight

#16 Post by TD-er » 04 Nov 2021, 20:59

Your link was not (yet) public, so I sent you a request for access.

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: Notepad++ Rules syntax highlight

#17 Post by Patou » 04 Nov 2021, 21:24

Done hope is now available

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Notepad++ Rules syntax highlight

#18 Post by TD-er » 04 Nov 2021, 21:32

It is.
Apparently you didn't base it on the latest changes I made as the list of events is shorter now.

You also have some control URL commands in the Keywords8

Code: Select all

/control?cmd=relay
/control?cmd=relaypulse
/control?cmd=ydim
This is the list of events I had in the latest version:

Code: Select all

Clock#Time=
GPIO#
Login#Failed
MQTT#Connected
MQTT#Disconnected
MQTTimport#Connected
MQTTimport#Disconnected
Rules#Timer=
System#Boot
System#BootMode
System#Sleep
System#Wake
TaskExit#
TaskInit#
Time#Initialized
Time#Set
WiFi#APmodeDisabled
WiFi#APmodeEnabled
WiFi#ChangedAccesspoint
WiFi#ChangedWiFichannel
WiFi#Connected
I will now try the file, instead of just looking at the diff :)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Notepad++ Rules syntax highlight

#19 Post by TD-er » 04 Nov 2021, 21:39

Found a bug in it, when folding.
if...endif match OK, but on...endon do not match.
If you fold an "on" part, all till the end of the file is folded.
Or at least it doesn't work if you have an if...endif nested in an on...endon

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Notepad++ Rules syntax highlight

#20 Post by TD-er » 04 Nov 2021, 22:07

Ah foudn a way to fix it, the on...endon must be folded using the Folding in comment style, as we don't have multiline comments anyway.

Will make a new version of it.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Notepad++ Rules syntax highlight

#21 Post by TD-er » 04 Nov 2021, 22:51

Attached the updated file, with the changes made by Patou, added the events and tweaked the nesting a bit more to allow some formatting in strings and highlight %...% along with system events.
I also added the , and the # to the list of operators, so they are clearly noticable when looking over the rules.

Created a new PR for it, including a number of screenshots: https://github.com/Grovkillen/ESP_Easy_ ... lus/pull/2
Attachments
userDefinedLang-ESP_Easy_rule2021.zip
(2.04 KiB) Downloaded 181 times

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: Notepad++ Rules syntax highlight

#22 Post by Patou » 05 Nov 2021, 17:16

Perfect ...
I shall test in the coming days
Have a nice wk
Patou

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Notepad++ Rules syntax highlight

#23 Post by ThomasB » 05 Nov 2021, 18:49

@Patou & @TD-er, Thanks for updating this.

- Thomas

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: Notepad++ Rules syntax highlight

#24 Post by chromo23 » 06 Nov 2021, 13:00

And now it would be cool to have somebody doing it for vs code... :D
For all the poor mac user.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 34 guests