From 2ed934120c779c7101a071a87171fcd8dea85acc Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 8 Apr 2015 14:39:39 +0100 Subject: [PATCH] Fix display of annotations when switching files in ace editor The annotations (error markers) were not preserved when switching between files. The setAnnotations method was being called before the document is ready -- when the document is attached to ace the content is deleted and reinserted, which caused the annotations to be removed. To fix the problem we set the annotations after attaching. --- .../web/public/coffee/ide/editor/directives/aceEditor.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee index bfd6fca912..3b9b81fae4 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee @@ -170,8 +170,6 @@ define [ session = editor.getSession() session.setUseWrapMode(true) session.setMode("ace/mode/latex") - session.setAnnotations scope.annotations - updateCount = 0 onChange = () -> @@ -193,6 +191,9 @@ define [ undoManager.nextUpdateIsRemote = true sharejs_doc.attachToAce(editor) + # need to set annotations after attaching because attaching + # deletes and then inserts document content + session.setAnnotations scope.annotations editor.focus()