     atom.workspaceView.command 'simple-flake8:toggle', => @toggle()
 
   getFilterKey: ->
-    'eventDescription'
+    'message'
 
   toggle: ->
     if @hasParent()

    editor = atom.workspace.getActiveEditor()
    return unless editor?
    return unless editor.getGrammar().name == 'Python'
    #
    # @storeFocusedElement()
    #
    # if @previouslyFocusedElement[0] and @previouslyFocusedElement[0] isnt document.body
    #   @eventElement = @previouslyFocusedElement
    # else
    #   @eventElement = atom.workspaceView

    @eventElement = atom.workspaceView
    filePath = editor.getPath()

    error_list = []
    flake filePath, (errors) ->
      if errors.length == 0
        return

      for error in errors
        if error.type
          message = error.type + " " + error.message
        else
          message = error.message
        console.log(message)
        error_list.push({message, error})

    @setItems(error_list)

    atom.workspaceView.append(this)
    @focusFilterEditor()

  viewForItem: ({eventName, eventDescription}) ->
    keyBindings = @keyBindings
    $$ ->
      @li class: 'event', 'data-event-name': eventName, =>
        @div class: 'pull-right', =>
          for binding in keyBindings when binding.command is eventName
            @kbd _.humanizeKeystroke(binding.keystrokes), class: 'key-binding'
        @span eventDescription, title: eventName

  confirmed: ({eventName}) ->
    @cancel()


  # Watch for the exit code
  proc.on 'exit', (exit_code, signal) ->
    if exit_code == 1 and errors.length == 0
      console.log('Flake8 is crashing. Check flake8 bin path.')
    callback errors

module.exports =


class SimpleFlake8View extends SelectListView

