如何在Komodo Edit中的“大”文件上启用语法高亮显示?

时间:2013-04-15 20:16:38

标签: configuration syntax-highlighting komodo komodoedit

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拒绝语法突出显示它。

2 个答案:

答案 0 :(得分: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"
    })();
}

然后从工具箱中执行它所需的次数,或随意更改乘法,为您自己的常量值。

希望它会有所帮助。

答案 1 :(得分: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以测试更改。

<强>参考