This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-11
Channels
- # announcements (3)
- # aws (3)
- # babashka (79)
- # beginners (105)
- # calva (10)
- # chlorine-clover (22)
- # clj-kondo (12)
- # cljs-dev (39)
- # clojure (52)
- # clojure-europe (1)
- # clojure-spec (15)
- # clojure-uk (12)
- # clojurescript (47)
- # conjure (93)
- # data-science (1)
- # datomic (10)
- # emacs (6)
- # figwheel-main (14)
- # fulcro (30)
- # instaparse (3)
- # kaocha (2)
- # lambdaisland (3)
- # malli (2)
- # meander (6)
- # off-topic (27)
- # pathom (14)
- # perun (1)
- # reagent (15)
- # shadow-cljs (69)
- # slack-help (2)
- # spacemacs (5)
- # test-check (23)
- # vim (9)
@wilkerlucio @jkrasnay Perhaps better luck with v0.0.82 and Cursive / vim nREPL. We changed to a BufferedOutputStream
now when writing messages which maybe helps.
the nrepl stuff is seriously cool! Fireplace doesn’t auto detect the connection for me and I’m not seeing an .nrepl-port
file, is that expected?
@martinklepsch that is expected, you have to just connect to the right port yourself
@borkdude got it. out of curiosity, did you actively decide against an .nrepl-port
file? & if: why?
@martinklepsch There have been discussions about this in #dev-tooling-task-force (closed channel, I can invite you if you want) and #conjure recently. Also here: https://github.com/borkdude/babashka/issues/157 The gist of it is that multiple tools can write .nrepl-port files. Also it assumes just a single server at a time, which is not how everyone uses it. Maybe a nice compromise is: only write an .nrepl-port file if it doesn't exist? I don't know the right answer and honestly, I can live with manually entering the port number (cc @pez @sogaiu @bozhidar)
you can write an .nrepl-port file yourself using a small bb script which also launches the nrepl server, but that's up to the user
I documented such a script here: https://github.com/borkdude/babashka/issues/157#issuecomment-609754426
yep just saw, very cool. babashka is getting really impressive :star-struck:
alright, thanks for the explanation, i guess I’m fine with entering the port manually too 😄
It is something that I expected from an nREPL server though. Maybe a note on startup would help clear that kind of confusion. But then again probably not such a big deal 🙂
I think printing a link to some documentation about the bb nREPL at startup might be most flexible. Then we can also document that script there.
@martinklepsch aside from .nrepl-port
do you have vim-fireplace working with the bb nREPL server?
@jkrasnay I actually don’t! I’m getting an error Error detected while processing function <SNR>63_printop[1]..<SNR>63_opfunc[35]..<SNR>63_buffer_path[3]..fireplace#path[4]..5:
some existing nREPL clients assume too much about the nREPL server they're connecting to, so that may be the issue here
environments that are known to work: - Emacs / CIDER - lein repl :connect - Calva - Chlorine - vim-iced - conjure?
For debugging you may start the server with BABASHKA_DEV=true bb --nrepl-server
, it will print the last messages that it received
I’m getting a very similar error. Sadly I don’t know enough vimscript to try debugging it.
I’m gonna give bleeding edge conjure a try 🙂
If I knew how to exit vim, I would also give it a try, but I don't. Don't know which env@rahul080327 is using, I think vim-iced.
joke as a way of expressing that I don't know enough about vim to give it a try without spending a lot of time on it
bb 0.0.82: release updated with windows binary https://github.com/borkdude/babashka/releases/tag/v0.0.82
So :CljEval (+ 1 1)
works! The form gets sent and eval’d by bb and the result is displayed in the Vim command area. The problem seems to arise when eval’ing forms in the source file. I think perhaps fireplace is choking when trying to figure out the namespace.
Yep, definitely looks like a fireplace-specific quirk. Thanks for you help, and double-thanks for bb/sci. Awesome stuff!
Looking at this a little closer. It looks like when fireplace first connects it sends two forms together in one request
"Received" {:code "(System/getProperty \"path.separator\") (or (System/getProperty \"fake.class.path\") (System/getProperty \"java.class.path\") \"\") (System/getProperty \"user.dir\")", :id "733e35a2-f6fa-4567-85af-b0e088d3e0d1", :op :eval}
I wonder if fireplace was expecting to get back a two-element collection or something. Does this make any sense?
if it expects back a vector, why doesn't it wrap that expression in a vector... ? @bozhidar what are the semantics in nREPL when asking for :eval
with multiple top-level expressions?
@jkrasnay is it possible to test if that fixes the issue, can you run fireplace from source somehow?
fwiw, if I test against an nREPL server when started with lein repl
and fire "(+ 1 2 3) (+ 1 2 3)"
at it, I just get "6"
back
If I send that with fireplace to a lein repl I get two sixes, printed on separate lines
@jkrasnay Gotcha!
(ns nrepl-client
(:require [bencode.core :as b]))
(defn read-until-done [in]
(loop []
(let [msg (b/read-bencode in)
value (get msg "value")
status (get msg "status")
status (when status (set (map #(String. %) status)))]
(when value (prn (String. value)))
(when-not (contains? status "done")
(recur)))))
(defn nrepl-eval [port expr]
(let [s (.Socket. "localhost" port)
out (.getOutputStream s)
in (.PushbackInputStream. (.getInputStream s))
_ (b/write-bencode out {"op" "eval" "code" expr})]
(read-until-done in)))
(nrepl-eval 64964 "(+ 1 2 3) (+ 1 2 3)")
;;=> "6"
;;=> "6"
@jkrasnay I now pushed a fix for that to master. Can you try with:
clojure -A:main --nrepl-server 1667
and then connect with fireplace?@jkrasnay Binaries are now also being published to #babashka_circleci_builds so you could also try one of those. @martinklepsch Same for you btw, you can grab a new binary for testing from there with the reader issue fixed.
@wilkerlucio would be interesting to check if that commit also fixes nREPL for Cursive...
@borkdude how can I try this version? I tried cloning and running clj -A:main
, but got an error:
wilkerlucio@Wilkers-MacBook-Pro-2 babashka % clj -A:main
Syntax error (FileNotFoundException) compiling at (babashka/impl/async.clj:1:1).
Could not locate sci/impl/vars__init.class, sci/impl/vars.clj or sci/impl/vars.cljc on classpath.
Full report at:
/var/folders/19/s31k0b7j4gl5f4zdl2cd77nc0000gn/T/clojure-8830231708591233376.edn
@wilkerlucio Try
git clone --recursive
and then clojure -A:main --nrepl-server 1667
got same results as before on nrepl:
Connecting to remote nREPL server...
clojure.lang.ExceptionInfo: Unable to resolve classname: java.lang.reflect.Method [at line , column ]
Error initialising completion
Error initialising locals clearing:
clojure.lang.ExceptionInfo: Could not resolve symbol: *compiler-options* [at line 1, column 6]
clojure.lang.ExceptionInfo: Could not resolve symbol: clojure.core/clojure-version [at line 1, column 57]
Error initialising REPL:Error updating completions:
clojure.lang.ExceptionInfo: Could not resolve symbol: cursive.repl.runtime/completions [at line 1, column 2]
3
=> 3
Error updating completions:
clojure.lang.ExceptionInfo: Could not resolve symbol: cursive.repl.runtime/completions [at line 1, column 2]
ok folks.. I'm trying vim / fireplace ... It seems to be connected to the nREPL server... but how do I eval an expression? The README says :Eval
but that doesn't come up for me
@borkdude yes you need to be on a clojure buffer to activate fireplace
Eval should work now
also there is #vim too, more helpers there
seems like fireplace is not loaded
how did you install it?
ah maybe it has changed in recent versions.
I did what the README said:
mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone
vim -u NONE -c "helptags fireplace/doc" -c q
yeah im more used to vim-iced now