0
votes

Im trying to get ace editor to highlight with lucene syntax, however it seems to stop highlighting after a certain length if the text/code is all on the same line.

Further highlights works again if a line break is added at a point where highlighting is stopped.Need some help to figure out whats going wrong here.

Fiddle: 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;
}
1

1 Answers

1
votes

This is a performance optimization for long lines https://github.com/ajaxorg/ace/blob/v1.1.3/lib/ace/tokenizer.js#L308

use

editor.getSession().setMode("ace/mode/lucene", function() {
    session.getMode().getTokenizer().$setMaxTokenCount(10000)
});

to increase cutoff value.
Btw is Lucene actually used with such long lines?