     return if @destroyed
 
     @destroyed = true
+
+    # NOTE: Prevent delayed-refresh on destroyed editor.
+    @cancelDelayedRefresh()
+
     @constructor.unregister(this)
     @highlighter.destroy()
     @syncSubcriptions?.dispose()

      range = @editor.setTextInBufferRange(itemArea, texts.join("\n"), undo: 'skip')
      @setModifiedState(false)
      @editorLastRow = range.end.row

  debouncedPreview: ->
    @_debouncedPreview ?= _.debounce((=> @preview()), 100)
    @_debouncedPreview()

  observeChange: ->
    @editor.buffer.onDidChange (event) =>

      @excludedFiles = []
      @refresh()

  getItems: ({force, filePath}) ->
    if @cachedItems? and not force
      Promise.resolve(@cachedItems)
