代码之家  ›  专栏  ›  技术社区  ›  Naibaf

修复Sublime Text 2括号匹配>28 if()-测试?

  •  3
  • Naibaf  · 技术社区  · 10 年前

    当超过28个括号时,My Sublime Text 2 Editor不会自动匹配(卷曲)括号 if() 内部声明或28 {} 对。 More than 28 if()/{} pairs

    将数字减少到<时;28,它再次神奇地匹配括号,如下所示。我怀疑一旦超过元素数量,ST2默认就不再匹配。不管你认为我的代码有多傻,如果没有自动括号匹配,工作起来会很烦人。 enter image description here

    • 问题

    如何匹配括号,无论 if() / {} 对?

    • 备选问题

    默认情况下,哪个文本编辑器可以执行此操作?

    对于那些想尝试一下Sublime Text 2中的限制的人,下面是我处理过的代码:

    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;
        }
    }
    

    当做 奈巴夫

    1 回复  |  直到 10 年前
        1
  •  2
  •   Enteleform    10 年前

    使用:

    BracketHighlighter


    它有一个 search_threshold 允许您定义括号对匹配的最大字符数的设置。