Sublime Forum

Angle bracket matching in C++

#1

I was wondering in anyone has a good way to deal with matching angle brackets in C++ code (without using a plugin like BracketHighligter). I normally use BracketHighlighter anyway since it also gives you matching of #ifdef macros, but sometimes you want to fall back to something super simple.

Matching angle brackets in C++ is not extremely important, but it helps with template definitions and usage. The problem is that there are many < or > operators in statements which mess up the native matching a bit. See the attached screen capture for an example where it would be nice to have matching of the angle brackets on the vector variable line without it breaking after the < operator. Using BracketHighlighter for this does work, but I’d think the native matching should handle this the same way so that move_to(to: brackets) actually works.

0 Likes

#2

The bracket matching algorithm is hard-coded and probably only has a simple filter on string scopes, so I don’t think there is a way to fix this yourself.

0 Likes