 swankProtocol = require './swank-protocol'
 {Subscriber} = require 'emissary'
 
+ensimeMessageCounter = 1
+client = null
 
-ensimeMessageCounter = 1
 
 _portFile = null
 portFile = ->

  swankProtocol.buildMessage("(:swank-rpc #{msg} #{ensimeMessageCounter++})")

readDotEnsime = -> # TODO: error handling
  fs.readFileSync(atom.project.getPath() + '/.ensime')

startEnsime = (portFile) ->
  ensimeLocation = '~/dev/projects/ensime-src/dist'


initWithDotEnsime = (c) ->
  dotEnsime = readDotEnsime()

  initMsg = swankRpc("(swank:init-project #{dotEnsime})")
  console.log("Init Msg: #{initMsg}")
  c.write(initMsg)
