       range = @editor.setTextInBufferRange(itemArea, texts.join("\n"), undo: 'skip')
       @editorLastRow = range.end.row
 
-  observeStopChanging: ->
-    @editor.onDidStopChanging =>
-      if @autoPreviewOnNextStopChanging
-        @preview()
-        @autoPreviewOnNextStopChanging = false
+  debouncedPreview: ->
+    clearTimeout(@debouncedPreviewTimeout) if @debouncedPreviewTimeout?
+    preview = =>
+      @debouncedPreviewTimeout = null
+      @preview()
+    @debouncedPreviewTimeout = setTimeout(preview, @debouncedPreviewDelay)
 
   observeChange: ->
     @editor.buffer.onDidChange ({newRange, oldRange}) =>


  stopRefreshingDelay: 100
  stopRefreshingTimeout: null

  autoPreview: null
  autoPreviewOnQueryChange: null
  autoPreviewOnNextStopChanging: false

  preventSyncToEditor: false
  ignoreChange: false

    @disposables.add(
      @registerCommands()
      @observeChange()
      @observeCursorMove()
      @observeStopChangingActivePaneItem()
    )
