How do I avoid a context explosion with kate part syntax highlighting? I suggested the ability to set simple integer variables in rules when the rule matches, and checking the value of these integer variables for equality or greater or smaller than as an additional precondition for other rules, but it was rejected: 120544 – kate: syntax highlighting needs more flexible context rules: pop N contexts, then push a sequence of named contexts which is fair, it was the first random solution that came to my mind.
Currently, it seems like if I have 5 things that need to be tracked in separate “stacks”, I would need to have 25 contexts manually written out if I’m not entirely mistaken. See above bug report for more details. I haven’t really found a way around this, making it impractical to express many constructs correctly in a more context sensitive language.
This also applies to C++ that is mentioned in the bug report, where the current code folding of kate seems to treat code blocks and e.g. {0} the same which can lead to rather weird code folding behavior which I would argue is undesirable. It might be possible to tell these situations apart, but probably not in practice without a single stack of context that is available now. It would be cool to find some solution for this.
My apologies if this is too low a priority for anybody to care, though. But I think it would be helpful even for existing syntax highlightings like the C++ one to model some corner cases more correctly.