2

出于性能原因,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>

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

4

2 回答 2

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"
    })();
}

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

希望它会有所帮助。

于 2013-04-29T14:38:28.640 回答
0

在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 以测试更改。

参考

于 2013-04-18T20:57:55.917 回答