Page 1 of 1

Rainmeter Lexer

Posted: 16.12.2025 17:21
by sl23
If possible, would you be able to update these small inconsistency issues with the Rainmeter lexer:
1. INI files do not support end of line comments, ie, after a line of code, so could you make it that the highlighting is consistent after using something like this please:

Code: Select all

TransformationMatrix=(Cos(Rad([#[#CURRENTSECTION]])));(-1*Sin(Rad([#[#CURRENTSECTION]])));(Sin(Rad([#[#CURRENTSECTION]])));(Cos(Rad([#[#CURRENTSECTION]])));(([#CURRENTSECTION#:X]+15)-([#CURRENTSECTION#:X]+15)*Cos(Rad([#[#CURRENTSECTION]]))-([#CURRENTSECTION#:Y]+15)*Sin(Rad([#[#CURRENTSECTION]])));(([#CURRENTSECTION#:Y]+15)+([#CURRENTSECTION#:X]+15)*Sin(Rad([#[#CURRENTSECTION]]))-([#CURRENTSECTION#:Y]+15)*Cos(Rad([#[#CURRENTSECTION]])))

This is how it appears on my screen:
2025-12-16_5.11.23.jpg
In other words, the highlighting is changing to show as if it were a comment, but it is not a comment, it is code.
I think the semi-colon character ";" should keep it's Comment colour though. And comments should only be coloured if on their own line.
2. Variables are shown highlighted in any typical scenario, when typed like this:

Code: Select all

#CURRENTSECTION#
Appear this way:
2025-12-16_5.16.49.jpg
2025-12-16_5.16.49.jpg (1.94 KiB) Viewed 134 times
But when typed like this:

Code: Select all

[#BuiltInVariableName]
[#[#MeasureName]]
[#[#*AnyName*]]
nested in any form, they appear like this:
2025-12-16_5.18.51.jpg
2025-12-16_5.18.51.jpg (1.63 KiB) Viewed 134 times
It would be helpul if variables kept the same highlighting, though brackets should keep their colour rather than take on the variable colour if that is possible, for easier viewing.
Thanks Alexey! :mrgreen:

Re: Rainmeter Lexer

Posted: 16.12.2025 18:03
by main Alexey
fixed lexer is in the Git yet: https://github.com/CudaText-addons/CudaText-lexers
when all will be Ok, I will update the lex in the Addons Manager.

1. I got the idea. comments must begin only after line-begin, maybe with spaces/tabs before ';'.
fixed.

I did not get the idea:
2a. which chars are allowed in 'AnyName' here: [#[#*AnyName*]]
word-chars? any non-spaces / non-square-brackets?
2b. I hiltied this as a variable: [#BuiltInVariableName], but how should I hilite this: [#[#MeasureName]]
it is also a single var?
why don't you use only 1 pair of brackets: [#MeasureName]

Re: Rainmeter Lexer

Posted: 16.12.2025 18:19
by main Alexey
3. can you show the proper hilite of that long Rainmeter line, in other editors (which do it right)?

Re: Rainmeter Lexer

Posted: 17.12.2025 10:41
by sl23
1. That's great thank you.

2. Tbh, number 2 isn't too much of an issue, and on second thought maybe better as is! If the text contained within a nested variable could be coloured the same, ie, leaving the brackets and hash symbols as they are, that in itself would aid in spotting variables more easily. If you need more understanding of what they are, here's the page in the Rainmeter Manual.
But for the examples I posted:
[#VarName] - standard variable, but nested version.
#*VarName*# - Escaped standard variable.
[*MeasureName*] - Escaped Section variable.
[#[#CURRENTSECTION]] - Nested built-in variable.
[#[#*CURRENTSECTION*]] - Nested and escaped built-in variable.
[#CURRENTSECTION#:X] - Nested variable that gets the value of the X position of the meter to be displayed.

3. I don't use other editors but tried Notepad++ but couldn't figure out how to change the highlighting so gave up. But if this helps:
This would be highlighted in this way:

Code: Select all

TransformationMatrix=(Cos(Rad([#[#CURRENTSECTION]])));(-1*Sin(Rad([#[#CURRENTSECTION]])));(Sin(Rad([#[#CURRENTSECTION]])));(Cos(Rad([#[#CURRENTSECTION]])));(([#CURRENTSECTION#:X]+15)-([#CURRENTSECTION#:X]+15)*Cos(Rad([#[#CURRENTSECTION]]))-([#CURRENTSECTION#:Y]+15)*Sin(Rad([#[#CURRENTSECTION]])));(([#CURRENTSECTION#:Y]+15)+([#CURRENTSECTION#:X]+15)*Sin(Rad([#[#CURRENTSECTION]]))-([#CURRENTSECTION#:Y]+15)*Cos(Rad([#[#CURRENTSECTION]])))

  • TransformationMatrix= - same as Key= as is done now.
  • (Cos(Rad([#[#CURRENTSECTION]]))) - This is highlighted ok.
  • Suggest highlighting all instances of ";" the same as a commented line.
  • (-1*Sin(Rad([#[#CURRENTSECTION]]))) - Apply the same rules for highlighting this as you would the code that appeared before the ";" and after the "=" which is how it would appear in a normal line that didn't contain the ";" character.
  • Simply repeat the above for the rest of the line.
Obviously the names can be literally anything. I think the best way would be to change the actual variable name ONLY, while keeping the rest of the highlighting exactly as it is now. Just change the highlighting of the variable's name to use the same highlighting as the standard variable, so as to make this:
2025-12-17_11.09.39.jpg
2025-12-17_11.09.39.jpg (6.66 KiB) Viewed 98 times
Look like this mock up:
2025-12-17_11.09.39v2.jpg
And for the long line of code, it should look like this:
2025-12-17_11.12.44.jpg

Re: Rainmeter Lexer

Posted: 17.12.2025 12:49
by main Alexey
I made changes, here almost all lines (except Escaped Section variable) are hiltied as vars.

Code: Select all

[#VarName]  
#*VarName*#  
[*MeasureName*]  
[#[#CURRENTSECTION]] 
[#[#*CURRENTSECTION*]] 
[#CURRENTSECTION#:X] 
Updated in Git.

Re: Rainmeter Lexer

Posted: 17.12.2025 13:43
by sl23
Amazing, thank you Alexey, very much appreciated! :D

Re: Rainmeter Lexer

Posted: 17.12.2025 13:47
by sl23
I updated the file and it is so much better! Thanks again :D