我试图让ace编辑器用lucene语法突出显示,但是如果文本/代码全部在同一行上,它似乎会在一定长度后停止突出显示。
如果在突出显示停止的位置添加换行符,则会再次突出显示。需要一些帮助来弄清楚这里出了什么问题。
小提琴:link
HTML:
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Editor</h3>
</div>
<div class="panel-body">
<div id="editor">agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))agf* AND ((sourcecode:=jyp AND sectionnumber:=4 OR sourcecode:=ast OR sourcecode:=eks OR sourcecode:=bta OR sourcecode:=tip) NOT (allheadings:((håndbold OR noter OR note OR 'ekstra bladet cup')) OR v_emner:frasort_navne OR heading:('?? år') OR '2. division' OR floorball OR 'division vest' OR v_emner:håndbold OR wordcount:<40))</div>
</div>
</div>
<div class="text-center">---End of editor---</div>
的JavaScript
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/lucene");
editor.getSession().setUseWrapMode(true);
CSS
#editor {
height: 800px;
}
答案 0 :(得分:0)
这是长行https://github.com/ajaxorg/ace/blob/v1.1.3/lib/ace/tokenizer.js#L308
的性能优化使用
editor.getSession().setMode("ace/mode/lucene", function() {
session.getMode().getTokenizer().$setMaxTokenCount(10000)
});
增加截止值。
顺便说一句,Lucene实际上是用这么长的线路吗?