   onBackendIdle: (callback) =>
     @emitter.on 'backend-idle', callback
 
-  queueCmd: (runFunc, rootDir, command, callback) =>
-    @commandQueue.push({f:runFunc,rd:rootDir,cmd:command,cb:callback})
-    @runQueuedCommands()
-
-  runQueuedCommands: =>
-    if @commandQueue.length == 0
-      @emitter.emit 'backend-idle'
+  queueCmd: (qn, runFunc, rootDir, command, callback) =>
+    @commandQueues[qn].queue.push
+      f:runFunc
+      rd:rootDir
+      cmd:command
+      cb:callback
+    @runQueuedCommands qn
+
+  runQueuedCommands: (qn) =>
+    if @commandQueues[qn].queue.length == 0
+      @emitter.emit 'backend-idle', qn
       return
-    else if @commandRunning
+    else if @commandQueues[qn].running
       return
 
-    @commandRunning = true
-    {f,rd,cmd,cb}=@commandQueue.shift()
-    @emitter.emit 'backend-active', cmd.join(' ')
+    @commandQueues[qn].running = true
+    {f,rd,cmd,cb}=@commandQueues[qn].queue.shift()
+    @emitter.emit 'backend-active', {queue: qn, command: cmd.join(' ')}
     f rd, cmd, (lines) =>
       cb lines
-      @commandRunning=false
-      @runQueuedCommands()
+      @commandQueues[qn].running=false
+      @runQueuedCommands qn
 
   runCmd: (rootDir, command, callback) =>
     unless atom.config.get('haskell-ghc-mod.enableGhcModi')

  doCheckOrLintBuffer: (cmd, buffer, callback) =>
    @withTempFile buffer.getText(), (path,close) =>
      command = [cmd,path]
      @queueCmd @runModCmd, @getRootDir(buffer), command, (lines) ->
        close()
        results = []
        lines.forEach (line) ->

      cpos = crange.start
      command = ["type",path,"",cpos.row+1,cpos.column+1]

      @queueCmd 'typeinfo', @runCmd,
        atom.project.getDirectories()[0], command, (lines) ->
          close()
          [range,type]=lines.reduce ((acc,line) ->
            return acc if acc!=''
            tokens=line.split '"'
            pos=tokens[0].trim().split(' ').map (i)->i-1
            type=tokens[1]
            myrange = new Range [pos[0],pos[1]],[pos[2],pos[3]]
            return acc unless myrange.containsRange(crange)
            return [myrange,type]),
            ''
          type='???' unless type
          range=crange unless range
          callback range,type

  getInfo: (text,symbol,callback) =>
    @withTempFile text, (path,close) =>
      command = ["info",path,"",symbol]
      @queueCmd 'typeinfo', @runCmd,
        atom.project.getDirectories()[0], command, (lines) ->
          close()
          callback lines.join('\n'), path

  doCheck: (text, callback) =>
    @withTempFile text, (path,close) =>
      command = ["check",path]
      @queueCmd 'checklint', @runModCmd,
        atom.project.getDirectories()[0], command, (lines) ->
          close()
          lines.forEach (line) ->
            [m,file,row,col] = line.match(/^(.*?):([0-9]+):([0-9]+):/)
            callback new Point(row-1, col-1), line.replace(m,''), file, path

  #buffer commands
  getTypeInBuffer: (buffer, crange, callback) =>
