 
   addMarker: (marker) =>
     @view.addProblem(marker.getProperties().problem)
+
+  removeMarker: (marker) =>
+    @view.removeProblem(marker.getProperties().problem)
+
+  # Helpers
+
+  withValidMarker: (editor, marker, callback) =>
+    return unless marker.getProperties().isDartMarker
+
+    selectedBufferRange = editor.getSelectedBufferRange()
+    markerRange = marker.getBufferRange()
+    if markerRange.containsRange(selectedBufferRange)
+      callback(marker)
 
   findMarkersInRange: (editor, range) =>
     attrs =

    return if _.any(@problems, (p) => _.isEqual(p, problem))
    @problems.push problem

  reset: =>
    @problems = []


    @editorEvents.dispose()

    @editorEvents.add editor.onDidAddDecoration (decoration) =>
      marker = decoration.getMarker()
      @withValidMarker editor, marker, (marker) =>
        @addMarker(marker)

    @editorEvents.add editor.onDidRemoveDecoration (decoration) =>
      marker = decoration.getMarker()
      @withValidMarker editor, marker, (marker) =>
        @removeMarker(marker)

    @editorEvents.add editor.onDidChangeSelectionRange =>
      selectedBufferRange = editor.getSelectedBufferRange()
