This approach to handle large result chunks seems pretty neat: https://youtu.be/c52QhiXsmyI
Hi! I want to show a greeting message to the client when connected to my nrepl server but can't figure out how to use :greeting-fn
for that. The transport/tty-greeting
is quite simple but does not work with a non-tty transports it seems (my client reports the conn was reset when I try to use it). Any tips? 🙏
@holyjak Generally the clients are supposed to provide the greeting message. TTY is an exception as there if you don’t send something server-side you won’t even realize you’ve connected.
If you elaborate on what you’re trying to achieve I might be able to give you some alternative idea.
Btw, I’m puzzled that the greeting fn approach didn’t work for you - it’s a very generic way of sending some message(s) on connect. This should be just fine regardless of your transport.
Thanks @bozhidar! I have a legacy java/groovy app and want to start a nrepl server within the app so that I could explore it while it is running. I also want to provide convenience vars, fns to interact with it, namely its Spring App.Context. I want to print a message when I connect from a nrepl client to show what vars / fns there are. As you can see, I have currently #_
-commented it out.
What’s the client you’re using? And what is the exact error you’re getting?
If I start the server like this, from a clj
repl: (require '[nrepl.server :as n]) (n/start-server :port 55555 :greeting-fn (fn [t] (send t {:out "Welcome!"})))
and connect to it from Cursive, I get at once in the client:
> Connecting to remote nREPL server...
> Exception starting REPL: java.net.SocketException: Connection reset
see the thread above https://clojurians.slack.com/archives/C17JYSA3H/p1543925226011000?thread_ts=1543925025.010300&cid=C17JYSA3H
Similarly from the command line:
$ clj -R:nrepl -m nrepl.cmdline --connect --host 127.0.0.1 --port 55555
Exception in thread "main" java.net.SocketException: The transport's socket appears to have lost its connection to the nREPL server
at nrepl.transport$bencode$fn__691$fn__692.invoke(transport.clj:92)
at nrepl.transport$bencode$fn__691.invoke(transport.clj:92)
at nrepl.transport$fn_transport$fn__647.invoke(transport.clj:39)
(The :nrepl
alias = {:extra-deps {nrepl/nrepl {:mvn/version "0.4.5"}}}
) (Same with nrepl 0.5.0)Please, meet our newest maintainer of nREPL - the one and only @cgrand! :man-bowing: Time to make nREPL as awesome as unREPL. 😉
Let’s make nrepl great again (oh this joke is getting old)
could it be a bug?
MNGA! I like it.
Hi! I've got
{:repl {:dependencies [[nrepl/nrepl "0.5.1"]]
:plugins [[cider/cider-nrepl "0.18.0"]]}}
in ~/.lein/profiles.clj, but when I cider-jack-in
I'm still getting nREPL 0.2.12. What might I be missing?@dchelimsky I don't know that cider attempts to use nrepl/nrepl with leiningen, it defers to leiningen. I'm not sure if lein-nrepl
(https://github.com/nrepl/lein-nrepl) can be configured to work.
https://github.com/nrepl/lein-nrepl#using-with-cider
(setq cider-inject-dependencies-at-jack-in nil)
(setq lein-parameters "nrepl")
Apparently 🙂Thanks for the help @dominicm. Unfortunately, I now have
:repl {:dependencies [[nrepl/nrepl "0.5.1"]]
:plugins [[cider/cider-nrepl "0.18.0"]
[nrepl/lein-nrepl "0.3.1"
:exclusions [org.clojure/clojure
nrepl
commons-io
commons-codec]]]}
in profiles.clj and (setq cider-inject-dependencies-at-jack-in nil)
(setq lein-parameters "nrepl")
in init.el and I still get nREPL 0.2.12@dchelimsky When jack-in runs, can you see whether it runs lein repl
or lein nrepl
?
repl
Which suggests that (setq lein-parameters "nrepl")
isn't being read
I'm not an emacs/cider user, so I'm not much help here I'm afraid. M-x customize-var
might be able to tell you the proper variable name though.
Just trying that
Oh, weird. Now I get "'nrepl' is not a task". Progress!
@dchelimsky I think your problem is that you've put the lein-nrepl
plugin inside of the :repl
profile. Maybe it should be the :user
profile? I guess :repl
is only loaded for lein repl
?
Yes, that makes sense. Now, of course, I'm getting dependency conflicts that are apparently not-resolvable. :pedantic? :abort
is telling me to exclude something but when I exclude it I still get the same message.
@dchelimsky Exclusions added to plugins are ignored. It's an counter-intuitive quirk of leiningen. The trick is to add a dependency on lein-nrepl
with the exclusions, as well as having the :plugins
for it.
"as well as having the :plugins
for it." meaning also include lein-nrepl in plugins, but without the exclusions?
@dchelimsky correct 🙂
I still get the messages if I leave out the exclusions from :plugins
@dchelimsky did you move them to :dependencies
?
:user {:dependencies [[nrepl/nrepl "0.5.1"]
[nrepl/lein-nrepl "0.3.1"
:exclusions [org.clojure/clojure
nrepl
commons-io
commons-codec]]]
:plugins [[cider/cider-nrepl "0.18.0"]
[nrepl/lein-nrepl "0.3.1"
:exclusions [org.clojure/clojure
nrepl
commons-io
commons-codec]]]
without the exclusions in :plugins
I get all the warning messages
oh, I'd thought that would work 😞 I'm not sure then, sorry. I know this is a weird thing that happens with plugins because of the trampoline system.
It gets even weirder, because now I also need to exclude clojure-complete
, but I'm not requiring that anywhere and it's showing up at the top of lein deps :tree
, meaning something, somewhere is injecting it 😕
And if I exclude it, I get compilation errors! Yay!
Thanks for trying to help @dominicm. I appreciate it.
Thank you for your talk on AWS 🙂 I'm excited to see what I can do with the aws libs! (although true input streams will be very useful for me!)
@dominicm feel free to comment on https://github.com/cognitect-labs/aws-api/issues/14
You're already ahead of me then! 😄 I will add my 👍 (assuming this is the equivalent of a JIRA vote)
Not equivalent of a JIRA vote, but it makes me feel good 🙂
Might end up being equivalent. We just haven't discussed it internally.