     return @emitter.on('did-update-messages', callback)
 
   deleteMessages: (linter) ->
-    if @messages.has(linter)
+    if @linterResponses.has(linter)
       @updated = true
-      @messages.delete(linter)
+      @linterResponses.delete(linter)
 
   deleteEditorMessages: (editor) ->
     if @editorMessages.has(editor)

  set: ({linter, messages, editor}) ->
    try validate.messages(messages) catch e then return helpers.error(e)
    if linter.scope is 'project'
      @messages.set(linter, messages)
    else
      throw new Error("Given editor isn't really an editor") unless editor instanceof TextEditor
      if not @editorMessages.has(editor) then @editorMessages.set(editor, new Map())

  deactivate: ->
    @shouldUpdatePublic = false
    @emitter.dispose()
    @linterResponses.clear()
    @editorMessages.clear()

module.exports = MessageRegistry
