This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-16
Channels
- # announcements (33)
- # asami (37)
- # autochrome-github (1)
- # aws (5)
- # babashka (26)
- # babashka-sci-dev (18)
- # beginners (63)
- # biff (1)
- # calva (66)
- # cider (15)
- # clj-kondo (24)
- # cljs-dev (2)
- # cljsrn (14)
- # clojure (62)
- # clojure-doc (1)
- # clojure-europe (15)
- # clojure-nl (11)
- # clojure-spec (12)
- # clojure-uk (4)
- # clojurescript (45)
- # community-development (2)
- # cursive (34)
- # datahike (7)
- # datomic (7)
- # events (1)
- # figwheel-main (5)
- # fulcro (19)
- # gratitude (7)
- # holy-lambda (85)
- # hyperfiddle (4)
- # jobs (7)
- # jobs-discuss (25)
- # kaocha (4)
- # lsp (11)
- # off-topic (1)
- # polylith (20)
- # portal (14)
- # practicalli (6)
- # proletarian (5)
- # rdf (52)
- # re-frame (13)
- # reagent (48)
- # releases (1)
- # remote-jobs (3)
- # shadow-cljs (7)
- # tools-deps (17)
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?
Nice solution! I’m also planning to allow REPL commands to insert the results in the editor, which would make that even slicker.

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: https://plugins.jetbrains.com/plugin/8320-uuid-generator
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!): https://clojurians.slack.com/archives/C0744GXCJ/p1675908328557129
Does cursive support inspecting data inside threaded macros or is adding a let the only way to see the intermediate state?
there is https://github.com/philoskim/debux, 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: [our.company.common :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
([x]
;; Print info about call-site
(let [[_this-invokeStatic _this-invoke call-site]
(-> (ex-info "" {}) .getStackTrace)]
(println)
(println "=== PROBE ===")
(println " at" (.toString call-site)))
(pp x)
x)
([xform x]
(probe (xform x))
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 _)))
pp/pprint)))
(defn pp
"Pretty-print val, preferably in color, if the puget lib is available."
([val]
(@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 (LineSet.java:200)
com.intellij.openapi.editor.impl.LineSet.getLineStart (LineSet.java:181)
com.intellij.openapi.editor.impl.DocumentImpl.getLineStartOffset (DocumentImpl.java:1017)
cursive.testing.actions$annotate_test$reify__17591.compute (actions.clj:102)
com.intellij.openapi.application.impl.ApplicationImpl.runReadAction (ApplicationImpl.java:841)
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 (MultiFn.java:229)
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$reify__14845.run (nrepl.clj:140)
com.intellij.openapi.application.impl.ApplicationImpl$1.run (ApplicationImpl.java:265)
java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
java.util.concurrent.FutureTask.run (FutureTask.java:264)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run (Executors.java:668)
java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run (Executors.java:665)
java.security.AccessController.doPrivileged (AccessController.java:-2)
java.util.concurrent.Executors$PrivilegedThreadFactory$1.run (Executors.java:665)
java.lang.Thread.run (Thread.java:829)
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:182)
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(RestFn.java:464)
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$reify__14845.run(nrepl.clj:140)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:265)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)
Unfortunately I can’t paste tests.but wait, probably you were right. I removed some extra code for debugging purpose and not I don’t have this errror
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? https://www.jetbrains.com/help/idea/remote-development-starting-page.html
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.
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