 {BufferedProcess} = require 'atom'
+{XRegExp} = require 'xregexp'
 
 class PscIde
   constructor: ->

      else
        @getCompletion prefix
          .then (completions) =>
            typeProms = []
            completions.forEach (c) =>
              promise = @getType c
                .then (type) =>
                  unqualType: @abbrevType type
                  text: c
                  type: type
              typeProms.push promise
            Promise.all(typeProms).then (types) =>
              resolve types.map (x) =>
                text: x.text
                displayText: x.text + ": " + x.unqualType
                description: x.type
                type: if /->/.test(x.type) then "function" else "value"

module.exports = PscIde

      args = ['-p', @pscIdePort]
      stdout = (output) =>
        console.debug "psc-ide", str, "-->", output
        resolve (@trimQuote output).trim()
      exit = (code) =>
        console.debug "exited with code #{code}"
        reject code if code is not 0
