   [options]
   (let [connection (get-connection options)
         client (nrepl/client connection 10000)
-        session (nrepl/new-session client)]
+        session (nrepl/new-session client)
+        completion-session (nrepl/new-session client) ]
     (reset! current-session session)
     (let [options (assoc options :prompt
                     (fn [ns]
                       (reader.jline/prepare-for-read
-                        (partial adhoc-eval client)
+                        (partial adhoc-eval client completion-session)
                         ns)))
           options (if (:color options)
                     (merge options nrepl.cmdline/colored-output)

          (let [input-result (.readLine *in*)]
            (nrepl/message client
              {:op "stdin" :stdin (str input-result "\n")
               :id (nrepl.misc/uuid) :session @current-session})))
        (when value ((:value options print) value))
        (when out ((:out options print) out))
        (when err ((:err options print) err))

                 (:host options "localhost"))]
    (nrepl/connect :host host :port port)))

(defn adhoc-eval [client session form]
  (let [results (atom "nil")]
    (execute-with-client
      client
      {:value (partial reset! results)
       :out print
       :err print
       :session session}
      (pr-str form))
    (read-string @results)))

