Sublime Forum

Syntax highlighting programmatically

#1

Is there a way, other than by doing regular expression matching on the buffer content, to influence the syntax highlighting? I am writing a plugin that inserts text into a buffer, and the plugin knows exactly which text it is inserting, so it can do the syntax highlighting quite easily. If I have to use regex matching, then I have to think up an easy-to-parse syntax for the buffer, which kind of sucks…

I tried to use add_regions, but that didn’t have the desired effects. See also this post: add_regions swaps background and foreground?

Now I was thinking maybe I can add markup to the buffer and then have the syntax highlighting hide the markup? But I couldn’t find a way to specify that something should be invisible in the *.tmTheme file or in the syntax definition…

0 Likes