Fork me on GitHub
#cursive
<
2022-01-12
>
dazld09:01:04

Do any of you know a good way to force nrepl output to go into the replpanel inside intelliJ?

1
imre09:01:41

Where else is it going?

dazld09:01:18

Into the nrepl output in terminal, sadly

imre09:01:43

I take it you run nrepl from the terminal then connect with Cursive?

dazld10:01:22

how does clojure decide which stream should get a particular ouptut? I can see the values of *out* are different in the terminal and in cursive, for example.

terminal:
*out*
#object[java.io.PrintWriter 0x207e6102 "[email protected]"]

cursive:
*out*
=> #object[java.io.PrintWriter 0x7da7dd2f "[email protected]"]

imre10:01:53

I'm not sure this is a Cursive thing, more of an nrepl one

imre10:01:05

afaik nrepl works on a request-response basis

imre10:01:28

cursive sends a request, nrepl replies

imre10:01:06

if you start nrepl outside of cursive, the latter won't have any control over the streams nrepl uses

imre10:01:00

Perhaps there is a way to configure nrepl itself to send stdout to its clients, but I wouldn't bet on it

👍 1
imre10:01:39

Do you have to start nrepl outside or can you start it from inside cursive?

imre10:01:04

I normally do the latter and nrepl output goes to the repl pane in that case

dazld10:01:45

generally, I’ve been doing like you, and starting a repl inside cursive - however, the project I’m working on has stuff working in parallel to the nrepl, so it might not work.

dazld10:01:06

hand on heart, I haven’t tried yet tho, was just wondering if there was a simple way to grab all the nrepl output into cursive ;)

cfleming20:01:17

This is a kind of murky area. nREPL does send output from evaluations to the client, and you should see those. For example, if you execute (println "Hello"). nREPL does this by binding *out* during evaluations, but that doesn’t work for everything, for example anything using System.out or anything kicked off from an eval which prints on a separate thread. If Cursive starts the REPL, then it controls the process and it will send the extra process output to the REPL pane too, but it can’t do that if you start it on the command line and then connect.

👍 1
Ivar Refsdal09:01:24

Hi @U3ZUC5M0R There is https://github.com/nrepl/nrepl/issues/119 (by me) which links https://gist.github.com/daviesian/4517859. Personally I just make sure (when I'm running nrepl in the terminal) to evaluate that fix before doing any nrepl stuff --- i.e. I'm requiring a namespace that does the fix.

clojure-spin 2
1
dazld09:01:30

@UGJE0MM0W amazing, that worked! thank you!

❤️ 1
Ivar Refsdal13:01:38

Glad I could help!

dazld16:01:20

@U0567Q30W perhaps an option could be added for remote repls? I guess it’d need to restore `*out*` bindings on close as well, and perhaps disable opening more than one repl if it’s selected.

borkdude12:01:33

clojure-extras: a plugin which builds on Cursive and adds extra features like clj-kondo linting, and inline eval:

👍 3
1
❤️ 2
🎉 1
imre14:01:26

What exactly are the differences between using built-in clj-kondo vs specified from path?

borkdude14:01:12

the built-in one is running in a JVM and should be faster one it's started, the binary is used to shell out to every time you change something, which should also work fine

imre14:01:36

but if I use the binary then I might get updates quicker via brew, is that a good assumption?

borkdude14:01:37

but I hope and also think @UQTHDKJ8J will keep the plugin up to date

💯 1
borkdude14:01:44

and else you can help by doing so via a PR

imre14:01:17

Thank you for the info

imre14:01:42

this is a much much nicer integration already than file watcher or lsp

❤️ 2
imre14:01:50

at least in my experience

souenzzo21:01:29

maybe in the future we can add a version selector like this, then we will be able to choose the version directly from maven.

borkdude21:01:11

Good idea, but that would mean clj-kondo would have to run in its own process rather than in the plugin. Still possible though, for example using the pod interface that it already has.

souenzzo21:01:59

Not sure how cursive does, if it spawns a new process, or if use some advanced classpath thing from intellij if it spawn a new process, the communication can be done via pod -like process 👀

Liverm0r14:02:17

About the ‘open repl file buffer’. I would definitely like to be able to work with it like with plain text buffer, being able to modify it, copy and use it with vimium plugin. https://www.reddit.com/r/Clojure/comments/lzx0zb/did_you_know_that_ideacursive_repl_results_may_be/ to achieve it with ‘add new repl command’ (may be someone will find it useful).

borkdude14:02:56

@UL05W6AEM There's a channel now: #clj-extras-plugin

thanks3 1
jacekschae15:01:16

Cursive supports converting HTML to Hiccup on paste. Would it be possible to have the same thing for Fulcro's HTML? There is even a functions that does the job at Developers Guide -- https://book.fulcrologic.com/#_converting_html_to_fulcro. Would people be interested in this feature? cc: @tony.kay

👍 3
cfleming20:01:29

The problem is knowing which to convert to, I guess that would have to be a project-specific flag, possibly with a checkbox on the popup. But I can do that, sure. Could you file an issue for that?

jacekschae05:01:17

Thanks Colin! Project specific sounds like a good idea to me. Here's the issue: https://github.com/cursive-ide/cursive/issues/2636