Fork me on GitHub

Q: I’m often editing edn or clojure files and need to insert a uuid. I jump to the repl and call (UUID/randomUUID) then copy and paste. Could Cursive automate this so I can have a keybinding that inserts a fresh uuid at the cursor location?


how about a REPL command similar to this, with a keybinding assigned?

🙏 1

Nice solution! I’m also planning to allow REPL commands to insert the results in the editor, which would make that even slicker.

metal 2

Thanks! I never would have figured that out. works great. will look forward to that new feature @U0567Q30W so that it’s 1 keystroke instead of 2


Very late to this thread but there is also this plugin:


also, there is a /usr/bin/uuidgen on macOS by default. then u can also pipe it into pbcopy, if u want it on the clipboard (or as macOS calls it, Paste Board, hence *pb*copy) so u can have some shell command runner plugin, which does this on a keystroke. i usually just run such stuff from the built-in terminal (which i've bound to Cmd-2) i do miss the ability to copy the last REPL evaluation result into the clipboard though... that would be a great, reusable action!


The latest EAP, just out now, will allow you insert the results directly into the open editor, or also easily copy the result value (or both, if you’re really keen!):

🎉 1

Does cursive support inspecting data inside threaded macros or is adding a let the only way to see the intermediate state?


I'm not aware of a built-in way, but it would be nice


I usually do a tap thing in this case btw, like (-> foo :bar (doto tap>) :baz)


There’s no built-in solution for this at the moment, sorry.

👍 2

there is, which works on clojurescript too, but it's a bit too heavy-weight for my taste, so i've resorted to 1. have a live template definition, which types this for me: [ :refer :all] 2. then i add this to most of our NS forms 3. i defined a ? function, which pretty-prints any value (with puget.printer/cprint) and also returns it, so i can just drop it into threading forms i've originally called it probe, but ? doesn't seem to collide with anything so far and it's far easier to add and remove. it really feels akin to probing an electrical circuit with a multi-meter.


this is the source code:

(defn probe
   ;; Print info about call-site
   (let [[_this-invokeStatic _this-invoke call-site]
         (-> (ex-info "" {}) .getStackTrace)]
     (println "=== PROBE ===")
     (println " at" (.toString call-site)))
   (pp x)
  ([xform x]
   (probe (xform x))
i use that stack trace trickery to 1. ignore the stackelement of the probe function itself 2. print the top-most, relevant stack element in a format, which cursive can turn into a link in the REPL window that way i know where my probes are and quickly get to them, if i want to remove them.


pp is just a little automation around picking between clojure.pprint and puget.printer:

(defmacro >stderr [& body] `(binding [*out* *err*] [email protected]))

(def ^:private pretty-printer-fn
  "Delay loading the pretty-printer namespaces until they are actually used,
   to reduce process startup time."
  (delay (or #?(:clj (try (requiring-resolve 'puget.printer/cprint)
                          (catch Exception _)))

(defn pp
  "Pretty-print val, preferably in color, if the puget lib is available."
   (@pretty-printer-fn val))
  ([val opts-or-writer]
   (@pretty-printer-fn val opts-or-writer)))


ava.lang.Throwable: Error handling response
java.lang.IndexOutOfBoundsException: Wrong line: 523. Available lines count: 100
 at com.intellij.openapi.editor.impl.LineSet.checkLineIndex (
    com.intellij.openapi.editor.impl.LineSet.getLineStart (
    com.intellij.openapi.editor.impl.DocumentImpl.getLineStartOffset (
    cursive.testing.actions$annotate_test$reify__17591.compute (actions.clj:102)
    com.intellij.openapi.application.impl.ApplicationImpl.runReadAction (
    cursive.testing.actions$annotate_test.invokeStatic (actions.clj:99)
    cursive.testing.actions$annotate_test.invoke (actions.clj:97)
    cursive.testing.actions$fn__17692.invokeStatic (actions.clj:219)
    cursive.testing.actions/fn (actions.clj:215)
    clojure.lang.MultiFn.invoke (
    cursive.testing.actions$test_handler$process__17725.invoke (actions.clj:298)
    cursive.testing.actions$test_handler$reify__17728.out (actions.clj:310)
    cursive.repl.nrepl$handler.invokeStatic (nrepl.clj:78)
    cursive.repl.nrepl$handler.invoke (nrepl.clj:61)
    cursive.repl.nrepl$start$reify__14845$fn__14853.invoke (nrepl.clj:141)
    cursive.repl.nrepl$start$ (nrepl.clj:140)
    com.intellij.openapi.application.impl.ApplicationImpl$ (
    java.util.concurrent.Executors$ ( (
    java.util.concurrent.ThreadPoolExecutor.runWorker (
    java.util.concurrent.ThreadPoolExecutor$ (
    java.util.concurrent.Executors$PrivilegedThreadFactory$1$ (
    java.util.concurrent.Executors$PrivilegedThreadFactory$1$ ( (
    java.util.concurrent.Executors$PrivilegedThreadFactory$ ( (

	at com.intellij.openapi.diagnostic.Logger.error(
	at cursive.logging$do_error.invokeStatic(logging.clj:60)
	at cursive.logging$do_error.invoke(logging.clj:59)
	at cursive.logging$do_log.invokeStatic(logging.clj:45)
	at cursive.logging$do_log.doInvoke(logging.clj:38)
	at clojure.lang.RestFn.invoke(
	at cursive.repl$print_exception.invokeStatic(repl.clj:152)
	at cursive.repl$print_exception.invoke(repl.clj:150)
	at cursive.repl.nrepl$start$reify__14845$fn__14853.invoke(nrepl.clj:143)
	at cursive.repl.nrepl$start$
	at com.intellij.openapi.application.impl.ApplicationImpl$
	at java.base/java.util.concurrent.Executors$
	at java.base/
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$
	at java.base/ Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$
	at java.base/
Unfortunately I can’t paste tests.


Does the name of your test file conflict with another test file in your project?


no, at least I didn’t catch any


but wait, probably you were right. I removed some extra code for debugging purpose and not I don’t have this errror


this is huge code base old project


tests work if run not in cursive


although it works on another developer computer which use cursive too. I have the newest intellij and cursive stable version


it is happening in 1 ns, for the specific code, but it is very regular simple code without nothing special.


Anyone using cursive in a remote setup? Do REPL's run at local or at remote machine?


I don’t do this myself, but I’m also interested to know if anyone has tried this, and how well it worked.


intellij/idea remote still do not work. tried via local network (wired) and it is too slow.


I was not able to enable cursive plugin


(because it is too slow)


Ok @U0567Q30W, now in a fresh morning I did new tests: • Remote intellij works in small projects • I created a new file: deps.edn, it offers to install cursive. Accept & restart • After restart, even simple operations like show files in the project now are too slow/do not work • If i keep trying to use intellij (open menus, reboot ide, etc), it somehow autodisable cursive


I would like to send you some logs but I didn't understand where is the logs. The one that I found is from the client, that feels useless.


TLDR; you will need to explicitly support remote intellij 😕


2022-02-17 09:24:42,106 [ 419019] INFO - e.plugins.DisabledPluginsState - Plugins to disable: [com.cursiveclojure.cursive]