XYS syntax highlighting for Notepad++
XYS syntax highlighting for Notepad++
Hi,
I would like to share my definitions as well.
Notepad++ supports themes. As far as I understood they provide global color defaults as well as specific settings for the in-build supported languages. However, those settings appear to be somehow linked to the internal lexer (e.g., you can define keywords but no operators or delimiters). Fortunately there are User Defined Languages, which build upon any theme and offer great detail for customization. Attached you will find my current definition. I'm sure it can be tweaked/optimized much further, but it fits my needs so far quite well.
Downloads Install
You should close any running Notepad++ instance before going ahead.
Unzip, and
1. Either put UserDefineLang.xml simply into the $Notepad++_home folder, or if you already have created some own language definitions just copy the XY section over into the existing UserDefineLang.xml.
Note: I left in two further definitions for Batch and Powershell files. Just remove or don't copy them if not needed.
2. Put the theme file myDark.xml into $Notepad++_home\themes
3. Start Notepad++ and load the theme via Settings>Style Configurator, make sure global override for background color is checked. 4. Now the "XYS"-entry should be available in the User section (below the separator) of the Language menu.
Expected Outcome Enjoy!
Cheers,
Filehero
I would like to share my definitions as well.
Notepad++ supports themes. As far as I understood they provide global color defaults as well as specific settings for the in-build supported languages. However, those settings appear to be somehow linked to the internal lexer (e.g., you can define keywords but no operators or delimiters). Fortunately there are User Defined Languages, which build upon any theme and offer great detail for customization. Attached you will find my current definition. I'm sure it can be tweaked/optimized much further, but it fits my needs so far quite well.
Downloads Install
You should close any running Notepad++ instance before going ahead.
Unzip, and
1. Either put UserDefineLang.xml simply into the $Notepad++_home folder, or if you already have created some own language definitions just copy the XY section over into the existing UserDefineLang.xml.
Note: I left in two further definitions for Batch and Powershell files. Just remove or don't copy them if not needed.
2. Put the theme file myDark.xml into $Notepad++_home\themes
3. Start Notepad++ and load the theme via Settings>Style Configurator, make sure global override for background color is checked. 4. Now the "XYS"-entry should be available in the User section (below the separator) of the Language menu.
Expected Outcome Enjoy!
Cheers,
Filehero
-
- Posts: 1416
- Joined: 04 Nov 2008 05:35
- Location: Hanoi, Vietnam
Re: XYS syntax highlighting for Notepad++
Impressive
But you still need to highlight variables/Numeric inside quotes. That's the hard part
But you still need to highlight variables/Numeric inside quotes. That's the hard part
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
Re: XYS syntax highlighting for Notepad++
But variables only inside double quotes, I thinkbinocular222 wrote:Impressive
But you still need to highlight variables/Numeric inside quotes. That's the hard part
Inside single quotes they are just text
No question: numbers are always numbers
Win11 Pro 223H2 Gerrman
Re: XYS syntax highlighting for Notepad++
Like this?PeterH wrote:But variables only inside double quotes, I thinkbinocular222 wrote:Impressive
But you still need to highlight variables/Numeric inside quotes. That's the hard part
PeterH wrote:Inside single quotes they are just text
At String_2 output the lexer seems to "fail" so far.
Cheers,
Filehero
Last edited by Filehero on 16 Jun 2013 15:47, edited 1 time in total.
Re: XYS syntax highlighting for Notepad++
Hi FileHero,
How are you? Doesn't your msg line have String_3 twice and no String_2 in the NP++_quoting.png capture?
Ken
How are you? Doesn't your msg line have String_3 twice and no String_2 in the NP++_quoting.png capture?
Ken
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440
Re: XYS syntax highlighting for Notepad++
Hi Ken,
I'm fine. Just came back from a 4 hour trekking tour, it was quite hot and sweaty. How are you?
I have updated the image. Thanks for the pointer.
Now off for a long shower.
Cheers,
Filehero
I'm fine. Just came back from a 4 hour trekking tour, it was quite hot and sweaty. How are you?
Bingo! You have become a real XY coder, haven't you?klownboy wrote:Doesn't your msg line have String_3 twice and no String_2 in the NP++_quoting.png capture?
Ken
I have updated the image. Thanks for the pointer.
Now off for a long shower.
Cheers,
Filehero
Re: XYS syntax highlighting for Notepad++
It seems you changed something here, in between the time?Filehero wrote:Like this?PeterH wrote:But variables only inside double quotes, I thinkbinocular222 wrote:Impressive
But you still need to highlight variables/Numeric inside quotes. That's the hard partPeterH wrote:Inside single quotes they are just textLook at output of String_2.
At String_2 output the lexer seems to "fail" so far.
Cheers,
Filehero
As on the left side the msg() shows $string_3 instead of $string_2, but the right side shows the corrected output for $string_2?
When the 1st $string_3 in msg() would be changed to _2, I think everything looks very correct; colors as well as values! Very good indeed!
Win11 Pro 223H2 Gerrman
Re: XYS syntax highlighting for Notepad++
Thanks for checking, I'm happy with it, too.PeterH wrote:When the 1st $string_3 in msg() would be changed to _2, I think everything looks very correct; colors as well as values! Very good indeed!
This was the code I actually ran for the popup shot (actually the highlighting example is from an existing file where I - lazy me - just put in the lines):
Code: Select all
$VarSingleQuote = "SingleQuoted";
$VarDoubleQuote = "DoubleQuoted";
$String_1 = '$VarDoubleQuote\$VarSingleQuote 1 2 3 4 5';
$String_2 = '$VarDoubleQuote\"$VarSingleQuote" 1 2 3 4 5';
$String_3 = "$VarDoubleQuote\$VarSingleQuote 1 2 3 4 5";
$String_4 = "$VarDoubleQuote\'$VarSingleQuote' 1 2 3 4 5";
msg($String_1<br>$String_2<br>$String_3<br>$String_4);
And here's the updated UserDefineLang.xml: Cheers,
Filehero
Re: XYS syntax highlighting for Notepad++
If anyone is interested this is my Syntax Highlighting files that I've been using for years. I see the interest, so I'm offering my files scrutiny.
- Attachments
-
- xys_LexerType.zip
- 1. userDefineLang XML
2. LexerType XML addin to stylers.xml
stylers.model.xml - (2.18 KiB) Downloaded 260 times
Re: XYS syntax highlighting for Notepad++
So, I took quite a bit of time to make another UDL theme for Notepad++ but make more use of the features that UDL 2.0 have to offer.
It supports XYplorer's variables (<curitems>), special items ({Fullname}), system and XYplorer's own system variables (%osbitness%), Xyplorer's variables within strings ("This is a $String"), and other things.
Still not the best I think but of an improvement. Hope you like it! I probably will work on it more later but for now, I think it's quite usable. Also, it works best with dark themes. In the example pictures, I'm using the Twilight theme.
It supports XYplorer's variables (<curitems>), special items ({Fullname}), system and XYplorer's own system variables (%osbitness%), Xyplorer's variables within strings ("This is a $String"), and other things.
Still not the best I think but of an improvement. Hope you like it! I probably will work on it more later but for now, I think it's quite usable. Also, it works best with dark themes. In the example pictures, I'm using the Twilight theme.
- Attachments
-
- XYplorer UDL.zip
- (1.6 KiB) Downloaded 260 times
Re: XYS syntax highlighting for Notepad++
Working on this for days and so far everything work except literal strings and heredoc. Literal strings generally work but when you start using words like "Don't" "Won't" "It's" and more, it will fail. Here doc can't be done at the moment due to limitations of the current lexer engine for NP++. Loreia2, the developer for the lexer enginer said the next major version should have even more support for complex scenarios.
Anyway, I extracted all those variables for <variable> and %variable% and {variable} from the help manual and then modified and finally implemented them into the user defined language file. I know my color choices suck but for the moment I'm still testing them to make sure if it works well enough. Can you guys test them and give me comments? Try to break it so that I can see if I can hopefully fix it.
As I said before, literal strings and heredoc don't work so I already know that's "broken" (removed them). Thank you!
Anyway, I extracted all those variables for <variable> and %variable% and {variable} from the help manual and then modified and finally implemented them into the user defined language file. I know my color choices suck but for the moment I'm still testing them to make sure if it works well enough. Can you guys test them and give me comments? Try to break it so that I can see if I can hopefully fix it.
As I said before, literal strings and heredoc don't work so I already know that's "broken" (removed them). Thank you!
- Attachments
-
- XYplorer_UDL_2nd_Test.zip
- (1.77 KiB) Downloaded 284 times
Re: XYS syntax highlighting for Notepad++
Hi Enternal,
thanks for keeping this thread alive and your recent UDL theme. Don't know wether I like it better, but I will use it to check your "implementation".
Cheers,
Filehero
thanks for keeping this thread alive and your recent UDL theme. Don't know wether I like it better, but I will use it to check your "implementation".
Cheers,
Filehero
Re: XYS syntax highlighting for Notepad++
Haha you want to "steal" my implementation?! Anyway, what do you think of it so far? Working well for most cases? Also what do you think about this color choices:
EDIT: Uhh... I think that was a horrible joke I made. This UDL thing is already free to do whatever you want with it so the "steal" is bad taste of a joke. Sorry for that.
Last edited by Enternal on 27 Nov 2013 21:52, edited 2 times in total.
Re: XYS syntax highlighting for Notepad++
No - it's about understanding "only".Enternal wrote:Haha you want to "steal" my implementation?!
Cheers,
Filehero
Re: XYS syntax highlighting for Notepad++
Haha. I was hoping there would be more UDL around that is similar to the XYScripting language but not really. As a result, there's also a lot of trial and error. Also the documentation is a bit lacking since I did saw some really funky way of doing things with UDL which I don't think it was meant to support but it did work... or maybe it was supposed to do that... I don't know.Filehero wrote:No - it's about understanding "only".Enternal wrote:Haha you want to "steal" my implementation?!
Cheers,
Filehero
But were you able to break it with certain script?