Fork me on GitHub
#cursive
<
2022-11-13
>
Dustin Getz13:11:10

I found this cool cursive repl hook : https://www.reddit.com/r/Clojure/comments/lzx0zb/did_you_know_that_ideacursive_repl_results_may_be/. Is there a intellij API that we can call to put that contents into the clipboard?

Dustin Getz13:11:13

public abstract void setContents(@NotNull Transferable content); Transferrable content = ...; CopyPasteManager.getInstance().setContents(content);

Dustin Getz13:11:24

CopyPasteManager.getInstance().setContents(new StringSelection("hello world"));

Dustin Getz14:11:23

So the real q is: how do i "cross the streams" and run some code in the cursive process?

Dustin Getz20:11:17

(let [s (java.util.UUID/randomUUID)]
  (.setContents (.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit))
    (java.awt.datatransfer.StringSelection (str s))
    nil))
yeah looks great

cfleming20:11:51

I’m planning to update the REPL commands to have options to do this more automatically, but that’s a nice workaround in the meantime.

🔥 2