I have this highlight rules in custom mode that inherits TextHighlightRules:
this.$rules = {
"start": [
{
token: "variable",
regex: '{[a-zA-Z0-9_.]+}'
}
]
};
It works for strings like {foo} {bar}.
In this case editor.session.getTokens(0) will return two tokens.
But for some reason it doesn’t work for strings like: {foo}{bar}
In this case editor.session.getTokens(0) will return only one token {foo}{bar}.
How can I solve this issue?
I’ve tried separating token and it somehow worked correctly:
this.$rules = {
"start": [
{
token: ["variableStart", "variable", "variableEnd"],
regex: '({)([a-zA-Z0-9_.]+)(})'
}
]
};
But I hope there are other ways to solve it.