Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fix Sublime Text 2 brackets matching with > 28 if()-tests?

My Sublime Text 2 Editor is not automatically matching (curly) brackets when there are more than 28 if() statements inside or 28 {} pairs. More than 28 if()/{} pairs

When reducing the number to <28, it magically matches brackets again as you can see below. I suspect that ST2 is by default no longer matching once a No. of elements is exceeded. No matter how silly you may think that my code is, it is annoying to work without automatic bracket matching. enter image description here

  • Question

How can I match brackets regardless of no of if() / {} pairs?

  • Alternative Question

Which text editor may do this by default?

For those of you who want to give the limitation within Sublime Text 2 a try, here is the code I fiddled with:

function increment() {

    if (timeStamp > 21112) {
        $('#us').html("USA " + counterUSio + "/" + counterUSiorup + " " + "MW");
        counterUSio = 0;
        counterUSiorup = 0;
    }
    if (timeStamp > 33587) {
        $('#cn').html("CHN " + counterCNio + "/" + counterCNiorup + " " + "MW");
        counterCNio = 0;
        counterCNiorup = 0;
    }
    if (timeStamp > 19902) {
        $('#sr').html("RUS " + counterSRio + "/" + counterSRiorup + " " + "MW");
        counterSRio = 0;
        counterSRiorup = 0;
    }
    if (timeStamp > 42676) {
        $('#ae').html("AE " + counterAEio + "/" + counterAEiorup + " " + "MW");
        counterAEio = 0;
        counterAEiorup = 0;
    }
    if (timeStamp > 22449) {
        $('#de').html("DE " + counterDEio + "/" + counterDEiorup + " " + "MW");
        counterDEio = 0;
        counterDEiorup = 0;
    }
    if (timeStamp > 27107) {
        $('#ar').html("AR " + counterARio + "/" + counterARiorup + " " + "MW");
        counterARio = 0;
        counterARiorup = 0;
    }
    if (timeStamp > 28116) {
        $('#am').html("AM " + counterAMio + "/" + counterAMiorup + " " + "MW");
        counterAMio = 0;
        counterAMiorup = 0;
    }
    if (timeStamp > 22929) {
        $('#be').html("BE " + counterBEio + "/" + counterBEiorup + " " + "MW");
        counterBEio = 0;
        counterBEiorup = 0;
    }
    if (timeStamp > 27234) {
        $('#bg').html("BG " + counterBGio + "/" + counterBGiorup + " " + "MW");
        counterBGio = 0;
        counterBGiorup = 0;
    }
    if (timeStamp > 30042) {
        $('#br').html("BR " + counterBRio + "/" + counterBRiorup + " " + "MW");
        counterBRio = 0;
        counterBRiorup = 0;
    }
    if (timeStamp > 22801) {
        $('#ca').html("CA " + counterCAio + "/" + counterCAiorup + " " + "MW");
        counterCAio = 0;
        counterCAiorup = 0;
    }
    if (timeStamp > 24866) {
        $('#ch').html("CH " + counterCHio + "/" + counterCHiorup + " " + "MW");
        counterCHio = 0;
        counterCHiorup = 0;
    }
    if (timeStamp > 31102) {
        $('#cz').html("CZ " + counterCZio + "/" + counterCZiorup + " " + "MW");
        counterCZio = 0;
        counterCZiorup = 0;
    }
    if (timeStamp > 28164) {
        $('#fi').html("FI " + counterFIio + "/" + counterFIiorup + " " + "MW");
        counterFIio = 0;
        counterFIiorup = 0;
    }
    if (timeStamp > 21662) {
        $('#fr').html("FR " + counterFRio + "/" + counterFRiorup + " " + "MW");
        counterFRio = 0;
        counterFRiorup = 0;
    }
    if (timeStamp > 30313) {
        $('#hu').html("HU " + counterHUio + "/" + counterHUiorup + " " + "MW");
        counterHUio = 0;
        counterHUiorup = 0;
    }
    if (timeStamp > 25294) {
        $('#in').html("IN " + counterINio + "/" + counterINiorup + " " + "MW");
        counterINio = 0;
        counterINiorup = 0;
    }
    if (timeStamp > 40789) {
        $('#ir').html("IR " + counterIRio + "/" + counterIRiorup + " " + "MW");
        counterIRio = 0;
        counterIRiorup = 0;
    }
    if (timeStamp > 23143) {
        $('#it').html("IT " + counterITio + "/" + counterITiorup + " " + "MW");
        counterITio = 0;
        counterITiorup = 0;
    }
    if (timeStamp > 23310) {
        $('#jp').html("JP " + counterJPio + "/" + counterJPiorup + " " + "MW");
        counterJPio = 0;
        counterJPiorup = 0;
    }
    if (timeStamp > 26861) {
        $('#kz').html("KZ " + counterKZio + "/" + counterKZiorup + " " + "MW");
        counterKZio = 0;
        counterKZiorup = 0;
    }
    if (timeStamp > 28302) {
        $('#kr').html("KR " + counterKRio + "/" + counterKRiorup + " " + "MW");
        counterKRio = 0;
        counterKRiorup = 0;
    }
    if (timeStamp > 30681) {
        $('#lt').html("LT " + counterLTio + "/" + counterLTiorup + " " + "MW");
        counterLTio = 0;
        counterLTiorup = 0;
    }
    if (timeStamp > 32611) {
        $('#mx').html("MX " + counterMXio + "/" + counterMXiorup + " " + "MW");
        counterMXio = 0;
        counterMXiorup = 0;
    }
    if (timeStamp > 25129) {
        $('#nl').html("NL " + counterNLio + "/" + counterNLiorup + " " + "MW");
        counterNLio = 0;
        counterNLiorup = 0;
    }
    if (timeStamp > 26224) {
        $('#pk').html("PK " + counterPKio + "/" + counterPKiorup + " " + "MW");
        counterPKio = 0;
        counterPKiorup = 0;
    }
    if (timeStamp > 35257) {
        $('#ro').html("RO " + counterROio + "/" + counterROiorup + " " + "MW");
        counterROio = 0;
        counterROiorup = 0;
    }
    if (timeStamp > 35257) {
        $('#ro').html("RO " + counterROio + "/" + counterROiorup + " " + "MW");
        counterROio = 0;
        counterROiorup = 0;
    }
    if (timeStamp > 35257) {
        $('#ro').html("RO " + counterROio + "/" + counterROiorup + " " + "MW");
        counterROio = 0;
        counterROiorup = 0;
    }
    if (timeStamp > 35257) {
        $('#ro').html("RO " + counterROio + "/" + counterROiorup + " " + "MW");
        counterROio = 0;
        counterROiorup = 0;
    }
}

Regards, Naibaf

like image 277
Naibaf Avatar asked Dec 07 '25 21:12

Naibaf


1 Answers

Use:

BracketHighlighter


It has a search_threshold setting that allows you to define a maximum number of characters within which bracket pairs will be matched.

like image 71
Enteleform Avatar answered Dec 09 '25 09:12

Enteleform



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!