How can I style just the number prefix?
-
Hello
I’m trying to style the number prefix in this language definition. It doesn’t seem to work, and I can’t seem to find other styles that has this.
What I want is the prefix for numbers to be in a different style than the number. Like:
#05
I want the # to be in one style, and the 05 to be in another.
Any way to do this?
Thanks in advance!
Peter -
@Peter-Lind said in How can I style just the number prefix?:
Any way to do this?
In just native UDL? No.
With the EnhanceAnyLexer plugin, you could define a regex that would be used to change the foreground color of matched text. For example, if you want
#$ #% # $ %
as prefixes to numbers to be a different color than the rest of the number, you could use Plugins > EnhanceAnyLexer > Enhance current language, then use0x0000FF = (?-s)(#\$|#%|#|\$|%)(?=[0-9a-f])
You also either need to make sure that
3
isn’t in the list ofexcluded_styles
in that config, or use the newer syntax (described in the ini file) which allows specifying a regex only for the specific style #3.This will turn the
#$ #% # $ %
prefixes red, even though the rest of the number is pink; and if those sequences aren’t before a valid number, then it won’t be highlighted either:
-
@ PeterJones Thank you!