Allow regex in highlight and/or add ability for custom highlighting function
tryna make a typescript highlight but unfortunately I can't highlight types since it's ": any" but I don't have regex to capture that.
I don't see how that would be possible without modifying the GoDot engine's source code, as highlight_region is the only method remotely close to RegEx. I would love to be wrong & be corrected that there is a way, so for now I'll leave this issue opened
https://docs.godotengine.org/en/stable/classes/class_regex.html
for version 4.2 (the one i'm pretty sure you use):
var regex = RegEx.new() regex.compile("\w-(\d+)")
which then you can do
var result = regex.search("abc n-0123") if result: print(result.get_string())
And also the custom highlighting function would be useful outside of this anyway
Yes, the RegEx resource exists in Godot, however the CodeEdit node can only highlight using keywords and regions - no "from index 3 to index 7, color red"
Which, again, goes to:
I don't see how that would be possible without modifying the GoDot engine's source code
Ah i see, that’s unfortunate.
Are you able to remove old highlights? If so you could add custom highlighting which highlights a region matched by regex in the lua script then remove the old matches. Although i’m unsure how efficient it is…probably should try to get the code edit thing to allow regex / color by index->index
A region must have a symbol as the first match, not just any character.