【问题标题】:How can i enable syntax highlighting on "large" files in Komodo Edit?如何在 Komodo Edit 中启用“大”文件的语法突出显示?
【发布时间】:2013-04-15 20:16:37
【问题描述】:

出于性能原因,Komodo edit 8 禁用大文件的语法高亮显示。有什么地方可以调整阈值,或者完全禁用禁用?

我的 prefs.xml 有:

<long id="documentByteCountThreshold">1000000</long>
<long id="documentLineCountThreshold">20000</long>
<long id="documentLineLengthThreshold">32000</long>
<boolean id="donotask_treat_large_documents_as_text">0</boolean>

我的测试文件是 53520 个字符 (CP1252) 超过 1040 行 PHP,Komodo Edit 拒绝语法高亮它。

【问题讨论】:

    标签: configuration syntax-highlighting komodo komodoedit


    【解决方案1】:

    前段时间我创建了以下 javascript 宏。您需要将其添加到您的工具箱

    (即转到工具箱,右键单击,新建宏...并确保将 JavaScript 标记为语言,然后粘贴代码)

    宏代码

    var gprefs = Components.classes["@activestate.com/koPrefService;1"].
              getService(Components.interfaces.koIPrefService).prefs;
    
    var bUserIsSure = confirm(
        'Current max file size: '+(Math.floor(gprefs.getLongPref("documentByteCountThreshold")/1024/1024*100)/100)+'mb and '+gprefs.getLongPref("documentLineCountThreshold")+' lines. Do you want to increase it 10 times?'
    );
    
    if( bUserIsSure ){
        (function(){
    
            var gprefs = Components.classes["@activestate.com/koPrefService;1"].
              getService(Components.interfaces.koIPrefService).prefs;
            gprefs.setLongPref("documentByteCountThreshold", 10 * gprefs.getLongPref("documentByteCountThreshold"));
            gprefs.setLongPref("documentLineCountThreshold", 10 * gprefs.getLongPref("documentLineCountThreshold"));
            // No reason to change "documentLineLengthThreshold"
        })();
    }
    

    然后根据需要从工具箱中多次执行它,或者随意更改乘法,以获取您自己的常量值。

    希望它会有所帮助。

    【讨论】:

      【解决方案2】:

      prefs.p.xml 中使用以下设置:

      <!--
      These prefs are to keep Komodo from hanging when a document
      that hits at least one of these limits is loaded.  Komodo will
      treat the document as a Text file, meaning all language-specific
      functions, including code-colorizing, are dropped.
      The reason for the high first value is that long lines are
      costlier than long documents.  2013-11: Increase limits to
      2MB / 40K lines / 100K max line-length due to fixing bug 101267
      probably too low.
      Also, Komodo estimates that colorizing UDL-based documents
      takes about twice as long as languages with C++-based lexers,
      and adjusts the limits by 50% downward.
      -->
      <long id="documentByteCountThreshold">2000000</long> <!-- 2 MB -->
      <long id="documentLineCountThreshold">40000</long> <!-- 40K * 40c/line => 1.6 MB -->
      <long id="documentLineLengthThreshold">100000</long><!-- 100K -->
      <boolean id="donotask_treat_large_documents_as_text">0</boolean>
      

      Komodo 将首选项、宏、模板、键绑定方案和其他设置存储在称为用户数据目录的用户特定目录中。此目录的名称和位置因操作系统和 Komodo 版本而异:

      Windows Vista, Windows 7, Windows 8 or newer
      C:\Users\<user>\AppData\Local\ActiveState\Komodo[IDE|Edit]\<version>
      
      Windows XP or older
      C:\Documents and Settings\<username>\Local Settings\Application Data\ActiveState\Komodo[IDE|Edit]\<version>
      
      Linux
      /home/<user>/.komodo[ide|edit]/<version>
      
      Mac OS X
      /Users/<user>/Library/Application Support/Komodo[IDE|Edit]/<version>
      

      重新启动 Komodo 以测试更改。

      参考文献

      【讨论】:

      • 似乎对我没有任何影响
      • 是的(甚至重新启动),但它似乎没有禁用禁用:(
      • 向问题添加了设置,以及我的测试文件中的指标
      • 两者都试过了,因为命名不清楚它是禁用还是启用该功能的标志...
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-27
      • 2015-03-30
      • 2016-08-09
      • 2021-12-31
      • 2011-07-29
      相关资源
      最近更新 更多