1
votes

I have this code inside compositionComplete()

this.docEditor = aceEditorBindingHandler.getEditorBySelection($(docEditorSelector);
// this.docEditor is of type AceAjax.Editor

if (this.docEditor) {
        this.docEditor.getSession().on("tokenizerUpdate", () => {
            // do stuff
        });
    }

but it is never hit.

If I change the event to be on 'change' then code is hit when the content changes.
But that is not what I need.

Any idea ? anybody ?

1

1 Answers

1
votes

The tokenizer update is not called synchronously similar to the change event. See the example below for a demonstration of it's work.

<script src=https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js></script>

<script>
  editor = ace.edit(null, {
    mode: "ace/mode/javascript",
    minLines: 5,
    maxLines: 10,
  })
  var log = ace.edit(null, {
    mode: "ace/mode/javascript",
    minLines: 5,
    maxLines: 10,
  })

  document.documentElement.appendChild(editor.container)
  document.documentElement.appendChild(log.container)
  editor.session.on("tokenizerUpdate", () => {
    log.insert("tokenizerUpdate called " + Date.now() + "\n")
  })
</script>