     @editorView.off 'cursor:moved', @cancel
     delete @renameInfo
     true
+
+
+  ###
+  User events
+  ###
+
+  onBufferChanged: =>
+    @parse()
+
+  onCursorMoved: =>
+    clearTimeout @timeoutId
+    @timeoutId = setTimeout @updateReferences, 0
 
 
   ###

    @gutterView.update()

  onParseEnd: =>
    # return unless @isParsing
    # @isParsing = false
    @updateReferences()
    @editorView.off 'cursor:moved', @onCursorMoved
    @editorView.on 'cursor:moved', @onCursorMoved


  ###
  Reference finder process
  1. Stop listening cursor move event and reset views.
  2. Parse.
  3. Show errors and exit process when compile error is thrown.
  4. Show references.
  5. Start listening cursor move event.
  ###

  parse: ->
    @editorView.off 'cursor:moved', @onCursorMoved
    @hideError()
    @referenceView.update()

    text = @editor.buffer.getText()
    if text isnt @cachedText
      @cachedText = text
