         return
 
       return unless protocol is 'perl6-pod-preview:'
+
+      alert(pathname)
       
       try
         pathname = decodeURI(pathname) if pathname

    @subscriptions.add atom.commands.add 'atom-workspace', 'atom-perl6-editor-tools:toggle': => @toggle()

  deactivate: ->
    @modalPanel.destroy()
    @subscriptions.dispose()
    @atomPerl6EditorToolsView.destroy()

  serialize: ->
    atomPerl6EditorToolsViewState: @atomPerl6EditorToolsView.serialize()

  toggle: ->
    editor = atom.workspace.getActiveTextEditor()

      if host is 'editor'
        new AtomPerl6EditorToolsView(editorId: pathname.substring(1))
      else
        alert "Not an editor?"

    options =
      split: 'right'
      
    err = (err) ->
      throw err if err 
      console.log("It's saved!");
    fs.writeFile 'Sample.pm6', editor.getText(), err

    atom.workspace.open("perl6-pod-preview://editor/#{editor.id}", options).then (podPreviewEditor) ->
      #TODO File::Which perl6
      command = 'perl6'
      args    = ['--doc=HTML', 'Sample.pm6']
      stdout  = (output) ->
        console.log(output)
        atom.notifications.addSuccess(output)
        podPreviewEditor.setText output
        alert("Done!")
      exit    = (code) ->
        console.log("perl6 --doc exited with #{code}")
        atom.notifications.addInfo("'#{command} #{args.join(" ")}' exited with #{code}")
      process = new BufferedProcess({command, args, stdout, exit})


    #if @modalPanel.isVisible()
    #  @modalPanel.hide()
    #else
    #  @modalPanel.show()
