 
       @handleError err
       return false
-      
+
     # Update header to show the lang and file name
     if codeContext.argType is 'Line Based'
       @headerView.title.text "#{codeContext.lang} - #{codeContext.fileColonLine(false)}"

    if err?
      @handleError(err)
      return false
      
    return true

  setupRuntime: (codeContext) ->
    
    # Store information about the run
    commandContext = {}



    codeContext = new CodeContext(filename, filepath, textSource)
    codeContext.selection = selection

    # Get language
    lang = @getLang editor

    if @validateLang lang
      codeContext.lang = lang

    return codeContext

  lineRun: ->
    @resetView()
    codeContext = @buildCodeContext('Line Based')
    @start(codeContext) unless not codeContext?

  defaultRun: ->
    @resetView()
    codeContext = @buildCodeContext() # Until proven otherwise
    @start(codeContext) unless not codeContext?

  buildCodeContext: (argType='Selection Based') ->
    # Get current editor
    editor = atom.workspace.getActiveEditor()
    # No editor available, do nothing
    return unless editor?

    codeContext = @initCodeContext(editor)

    codeContext.argType = argType

    if argType == 'Line Based'
      editor.save()
    else if codeContext.selection.isEmpty() and codeContext.filepath?
      codeContext.argType = 'File Based'
      editor.save()

    # Selection and Line Based runs both benefit from knowing the current line
    # number
    unless argType == 'File Based'
      cursor = editor.getCursor()
      codeContext.lineNumber = cursor.getScreenRow() + 1

    return codeContext

  start: (codeContext) ->

    # If language was not determined, do nothing
    if not codeContext.lang?
      # In the future we could handle a runner without the language being part
      # of the grammar map, using the options runner
      return

    commandContext = @setupRuntime codeContext
    @run commandContext.command, commandContext.args if commandContext

