Is it possible to remove bold formatting using PythonScript
-
Hi everyone,
I am trying to remove a bold formatting that comes from an UDL using PythonScript and the EnhancedUDLLexer example which is modified.
Here is a concrete example
[TEST] ^ this is bold and should be bold PARAMETER = VALUE,[:d | smalltalk extension method], ^ this should not be bold, yet it currently is PARAMETER2 = VALUE2 ...
I already got a fitting regular expression ready, albeit being a little hacky:
\S{1,}.*(\[((?>[^\[\]]+|(?R))*)\])
However I am not able to modify the display of the found texts decoration. Changing the color works well, but isn’t what I want.
Is there anything I can do about this. If not by PythonScript, then eventually with UDL file modification.
Bonus points, if it is somehow possible to change syntax highlighting to the pre-installed “Smalltalk” but only inside the aforementioned statement. ;)
Thanks in advance!
Daniel -
No, you can’t. The reason is that lexers use styles and the script,
which by the way there is an updated version here, uses
indicators.
Indicators do not have access to all font attributes, well, the only
access they have is the font foreground color.I assume you’ve configured the [ and ] being delimiters with a bold style, correct?
Is it possible to define two like in this example?
-
This is a great idea, @Ekopalypse. Thank you for this one.
It works quite well, i guess. But I’ve come across an issue: Is there anything I can do to ignore spaces between the opening bracket and the colon, like when I use
[:i | ... ]
which is the same like
[ :i | ... ]
P.S.: Sorry for the late reply.
-
Is there anything I can do to ignore spaces between the opening bracket and the colon,
I don’t think so, let me think about it.
-
I’m sorry, but at the moment I don’t see how this could be solved other than doing the complete lexing with a dedicated plugin. Do you have some reasonable large code which you can share? Together with the information of what should be styled how?
-
OK, thank you for your effort!
I will try to work my way along your great example script here:
https://github.com/bruderstein/PythonScript/blob/master/scripts/Samples/EnhancedPythonLexer.py