'use babel'

import Opener from '../opener'

export default class AtomPdfOpener extends Opener {
  open (filePath, texPath, lineNumber, callback) {
    // Opens PDF in a new pane -- requires pdf-view module

    function forwardSync(pdfView) {
      if (pdfView != null && pdfView.forwardSync != null) {
        pdfView.forwardSync(texPath, lineNumber)
      }
    }

    const openPaneItems = atom.workspace.getPaneItems()
    for (const openPaneItem of openPaneItems) {
      // File is already open in another pane
      if (openPaneItem.filePath === filePath) {
        forwardSync(openPaneItem)
        return
      }
    }

    const activePane = atom.workspace.getActivePane()
    // TODO: Make this configurable?
    atom.workspace.open(filePath, {'split': 'right'}).done(function (pdfView) {
      forwardSync(pdfView)
    })

    // TODO: Check for actual success?
    if (callback) {
      callback(0)
    }
  }
}

@@ -217,32 +217,33 @@
 tion forwardSync
+ 
 (pdfView) %7B%0A    
@@ -628,62 +628,8 @@
  %7D%0A%0A
-    const activePane = atom.workspace.getActivePane()%0A
     
@@ -725,60 +725,18 @@
 ne(f
-unction (pdfView) %7B%0A      forwardSync(pdfView)%0A    %7D
+orwardSync
 )%0A%0A 

fix style and remove unused line