nrepl

bozhidar 2021-10-18T06:42:05.066900Z

Wasn't the context supposed to be just the containing form or something like this? Why would someone send the entire buffer?

dominicm 2021-10-18T17:39:27.076500Z

It is. But searching for matching parens so you only send the outermost form is expensive. I was trying to find an alternative that would be faster to run.

bozhidar 2021-10-18T06:42:36.067500Z

Seems to me that's compliment-specific, though, as nREPL's own completion doesn't even have a notion of completion context currently.

Nom Nom Mousse 2021-10-18T07:39:21.067700Z

@endrebak has joined the channel

yuhan 2021-10-18T12:37:17.070700Z

@qythium has joined the channel

yuhan 2021-10-18T13:03:51.075700Z

How can I start an nrepl server in some main ns that catches errors in the main application thread? I'm not sure if that question makes sense, but say there's some UI or "game loop" that is continually running alongside the server, like this:

(ns my-app
  (:require [nrepl.server :as server]
            cider.nrepl))

(defonce server
  (nrepl.server/start-server
    :port 7888
    :handler (apply nrepl.server/default-handler cider.nrepl/cider-middleware)))

(defn do-thing []
  (Thread/sleep 1000)
  (println (System/currentTimeMillis))
  ;; (inc nil)
  )

(defn -main [& args]
  (loop []
    (do-thing)
    (recur)))
instead of starting the nrepl server using -m nrepl.cmdline . I can then connect to the server with Cider and interactively redefine the do-thing function, but if it throws an error (eg. uncomment the (inc nil)), the entire process exits instead of triggering the stacktrace middleware.

bozhidar 2021-10-28T05:47:11.001800Z

Hmm, I never thought about this, so no answer immediately comes to mind. I assume the problem happens only for invocations that happen in -main right?

bozhidar 2021-10-28T05:47:26.002Z

Might be a good idea to post this on the issue tracker, so we won't forget about it.