You can use REBL with Cursive in a deps project by following the directions at https://github.com/cognitect-labs/REBL-distro/wiki/REBL-in-IntelliJ-Cursive. Works great!
One issue is that when you evaluate an expression in Cursive (specifically I'm doing "Send form before caret to REPL"), the expression that shows up in REBL has a lot of Cursive machinery wrapped around it:
(clojure.lang.Compiler/load (clojure.lang.LineNumberingPushbackReader. (java.io.StringReader. "in-ns 'foo)\n\n\n\n\n\n(hi 1)")) ...
rather than the actual expression (here just (hi 1)).
This is the stuff Cursive uses to get proper line and column numbers in error messages, etc. In Clojure 1.10, there is better support to do this via metadata on the expression itself without all the newline stuff.
Cursive could now instead annotate an expression with metadata:
^{:clojure.core/eval-file "a/b/foo.clj", :line 100, :column 1} (hi 1)
This will cause errors to throw with the proper source/line/column info, which I think was the main motivation for all the wrapping. REBL would not print the metadata and all you would see in REBL is (hi 1).
Some caveats: only in Clojure 1.10, can only apply metadata to expressions that can have metadata, but just sniffing the first character or two to indicate a collection would probably get it right 99% of the time.
You can use REBL with Cursive in a deps project by following the directions at https://github.com/cognitect-labs/REBL-distro/wiki/REBL-in-IntelliJ-Cursive. Works great!
One issue is that when you evaluate an expression in Cursive (specifically I'm doing "Send form before caret to REPL"), the expression that shows up in REBL has a lot of Cursive machinery wrapped around it:
rather than the actual expression (here just
(hi 1)).This is the stuff Cursive uses to get proper line and column numbers in error messages, etc. In Clojure 1.10, there is better support to do this via metadata on the expression itself without all the newline stuff.
Cursive could now instead annotate an expression with metadata:
This will cause errors to throw with the proper source/line/column info, which I think was the main motivation for all the wrapping. REBL would not print the metadata and all you would see in REBL is
(hi 1).Some caveats: only in Clojure 1.10, can only apply metadata to expressions that can have metadata, but just sniffing the first character or two to indicate a collection would probably get it right 99% of the time.