This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-08
Channels
- # announcements (4)
- # aws (1)
- # babashka (4)
- # beginners (75)
- # biff (4)
- # calva (13)
- # clojure (76)
- # clojure-android (1)
- # clojure-austin (9)
- # clojure-europe (14)
- # clojure-mexico (3)
- # clojure-nl (2)
- # clojure-norway (11)
- # clojure-uk (14)
- # clojurescript (19)
- # conjure (14)
- # cursive (30)
- # datomic (13)
- # gratitude (6)
- # hyperfiddle (71)
- # introduce-yourself (2)
- # juxt (5)
- # malli (5)
- # nbb (5)
- # nrepl (10)
- # off-topic (32)
- # re-frame (3)
- # releases (1)
- # shadow-cljs (5)
- # sql (38)
- # tools-deps (24)
- # xtdb (19)
I am not able to see the actual error message for a test failure, what's up? FWIW in this project i've never been able to 😞 There's no way of showing the difference
For what is worth we're using https://github.com/nubank/state-flow
So even though they are normal clojure tests, there's a few layers in between that maybe hide it from cursive
Is there any plan to work on this: https://github.com/cursive-ide/cursive/issues/1929 at some point? I can see that ticket was raised in 2018, and has had no comments or similar on it since. We've just started running REPLs via bazel
, because we're also using it for all our builds etc, and at the moment we're getting output appear in the terminal that the REPL itself is running in, not in the IntelliJ window that is connected to it. We also sometimes connect REPLs to our running system (K8s pods in AWS) to debug it, and hit the same problem there - some of the output we want ends up going to the pod log rather than the IntelliJ window
You might actually be able to do that these days with no change to Cursive, using the .nrepl.edn
config file, see https://cursive-ide.com/userguide/repl.html#configuring-middleware-for-nrepl-repls.
If that won’t work for whatever reason, let me know and I’ll look at that issue more closely.
Just to be clear, I think you should be able to use that config file to configure the CIDER middleware for your REPL.
Hmm, so I've gone digging, and we're already launching the REPL with all the relevant middleware running
But I have to admit I don't understand why, if the REPL server is being loaded with that middleware running, it would not send the output back to the connected Cursive REPL session
Ahha, asking in #nrepl and I got this https://clojurians.slack.com/archives/C17JYSA3H/p1659976888613829 Looks like I need to work out how to get the nREPL client from within Cursive, and send the out-subscribe
message to it. But this is something that is lower level than the REPL I'm used to interacting with, I think. Need to dig more. If I can do it in our user space that'll do for now, though if Cursive would do it automatically if the middleware was loaded, like Emacs does, that would be 🎉
Cross post from #nrepl as well, this gist has solved this issue for me (and other people here as well): https://gist.github.com/daviesian/4517859 nrepl issue: https://github.com/nrepl/nrepl/issues/119
I've fixed it with the following, which runs on REPL load because it's in our auto-loaded user
ns:
(ns user
(:require [nrepl.core :as nrepl]
[nrepl.misc :refer [uuid]])
(:import ( ConnectException)))
(try
(let [client (-> (nrepl/connect {:host "localhost" :port 4005})
(nrepl/client 1000))]
(nrepl/message client {:id (uuid) :op "out-subscribe"}))
(catch ConnectException _)) ; Don't care if it fails, we're probably not a remote REPL
Obviously it's a bit hacky, and you'd probably want something cleaner in Cursive proper, if it ran on every REPL start. Probably using the hostname/port provided in the config (I just know ours is always localhost with port forwards, and 4005), and actually checking if the middleware is loaded, like CIDER does, rather than just a try...catch
Is it a reasonable assumption that if that middleware is present then the client will always want to subscribe? I’m thinking probably yes.
Actually, I’m not sure about that, in this code snippet: https://clojurians.slack.com/archives/C17JYSA3H/p1659977276803309?thread_ts=1659976888.613829&cid=C17JYSA3H
The cider-redirect-server-output-to-repl
bit looks like a config flag to me - I’ll check that.
https://github.com/clojure-emacs/cider/blob/9577dbbdae8cffe023442427b97f963b4447983a/cider-connection.el#L329-L330 is where it's called, and https://github.com/clojure-emacs/cider/blob/9577dbbdae8cffe023442427b97f963b4447983a/cider-connection.el#L48-L55 is the definition. So you're definitely right that it's a config flag. I don't know where you'd see any default values. Certainly everyone in the team here who uses CIDER (or vim-fireplace
, which also makes use of cider-nrepl
extensions) has said "Oh, that Just Works for me", so either it's default true or everyone has cargo culted someone else's config file and never looked into what that option does 😉