Search code examples
javascriptace-editor

Ace editor's setAnnotations won't stay permanent


I have trouble getting my annotation to stay. See this jsfiddle: http://jsfiddle.net/c8k45yw1/5/

What you will see is line 2, which I set manually, will have "X" mark appear for half a second before it disappear. Thoughts?

var editor = ace.edit("editor");
editor.setTheme("ace/theme/chrome");
editor.getSession().setMode("ace/mode/javascript");
//editor.session.setBreakpoint(2);
editor.getSession().setAnnotations([{
  row: 1,
  column: 0,
  text: "Strange error",
  type: "error" // also warning and information
}]);

Solution

  • Syntax checker in ace uses same setAnnotations api, and clears old anotations. You can disable it with editor.session.setOption("useWorker", false)