Sublime Forum

Can't find matching bracket/brace

#1

I’ve found that for large code-blocks (200r ows say) sublime text can’t figure out what opening bracket the closing bracket matches up with. For this functionality only I have to use notepad++ and then return to ST for all else. Is there a way to fix this?

1 Like

#2

Did you try to use the Package BracketHighlighter?
Perhaps this package doesn’t have the same issue.

0 Likes

#3

That’s an awesome package! Just tried it out and it does very well with most of my code but the large structures get lost… on the very left it says ? next to the line number indicating that it can’t find the matching bracket. I’m not sure how notepad++ manages to do it. Unless there’s something wrong with the code (but it has always executed correctly for me).

0 Likes

#4

Just confirmed it’s a strange sublime text issue. At least for me when I try this dummy php code:

if ($a==$b) {
$c = “sadfasdfasdfasdfasdf”;
… repeat that line 134 times
}

then it loses the connection between the the two brackets. Any lower number of lines in the if statement works.

0 Likes

#5

BracketHighlighter purposely stops trying to find brackets after a certain threshold. The threshold is in the settings file. This is to ensure performances remains tolerable while you are typing and moving your cursor around. You can increase the threshold if you like. I also provide a command in brackethighlighter to do a on-demand search that will not use the threshold and search to the end of the file. There are also commands to jump between the brackets that also do not use the threshold. You can bind all of these commands to shortcuts if you like. I provide an example shortcut file to show you how.

1 Like

#6

Would be nice to be able to configure this, though the value of visual highlighting is somewhat lost across this many lines. Ctrl+M (jump to matching bracket) still works though, across any number of lines.

1 Like