Fork me on GitHub
#cider
<
2021-12-16
>
magnars08:12:16

Any clues as to why the CIDER repl doesn't include everything that is printed to out? I understand this might be a hairy issue, but it's becoming a problem for us when we no longer see cljs compilation errors. Any help would be appreciated. (more details in thread)

magnars08:12:46

In the terminal:

magnars08:12:46

Note how all the [Figwheel] logging is omitted. When the compile is successful, it's merely an inconvenience. But when it hides compilation errors, cue headaches.

vemv08:12:51

Have you checked in the Fig source the difference between strings prefixed with [Figwheel] , and strings without?

vemv08:12:07

I reckon they are printed/logged differently, should give a clue

magnars08:12:30

I'll look into that. I'd still like for CIDER to capture everything going to standard out, tho. Maybe that is naive.

vemv08:12:03

that diagnostic might be mistaken though, there's a good chance cider doesn't randomly decide to not relay certain lines from out

magnars08:12:50

I think you're right about that, for sure. I'm just confused by this whole thing.

magnars08:12:49

In particular, I am confused as to how a process writes to my terminal without printing to out , I guess.

vemv08:12:49

maybe it has "logging levels" of sorts. or maybe it's going to err idk

magnars09:12:11

I would certainly hope that err is also shown in the repl.

magnars09:12:43

These same log messages do show up in older versions of figwheel-main. So there's something there. Thanks for pointing me in the right direction.

👀 1
magnars09:12:31

👀 indeed. Now it's inconsistent instead. What a mess.

clojure-spin 1
magnars09:12:01

And with inconsistency came the new theory: It's a timing issue. The log statements appear if I do it manually (ie. slower).

vemv09:12:16

That might well make sense, perhaps the initial cljs compilation errors happen before a connection is established? (Don't quote me on that)

magnars09:12:00

It seems like something along those lines. Maybe the CLJS REPL-starting commands should wait for a connection to be established.

vemv09:12:16

Btw, if in a rush you can always use the cider-connect* family of functions, i.e. start the repl from the terminal

👍 1
magnars10:12:30

To summarise: (require 'figwheel.main) sets up its own logger. If this is done too early, it is set up to print somewhere CIDER doesn't look. Postponing the require to after CIDER is ready fixes all these issues. I would say this is a figwheel issue, not a CIDER-issue. Thanks for sparring with me, @vemv.

cider 1
vemv11:12:02

Cheers! Is there anything that we could improve cider side? Or should an issue be created in Fig?

magnars11:12:53

A workaround would be postponing the (do (require 'figwheel.main) ...) during jack-in-clojurescript , but it does not really solve the issue. If I place (:require [figwheel.main]) somewhere in my project code, that too would require it too soon - with no recourse for CIDER that I can think of. I've asked in the #figwheel-main channel here.

🤞 1
vemv09:12:32

ℹī¸ since this week cider.el master (snapshot) includes our latest tech (cider-nrepl, orchard, enrich-classpath) that makes Java jump-to-definition and other similarly core Java features finally possible. This works for the JDK core classes (`Thread` , File etc), third-party dependencies, and your own sources alike. Experience reports are very much welcome, before we cut a stable release.

🎉 2
👍 1
➕ 1
vemv09:12:10

It's a Lein-only feature for the time being, more context here https://clojurians.slack.com/archives/C6QH853H8/p1639467484052200

magnars10:12:30

To summarise: (require 'figwheel.main) sets up its own logger. If this is done too early, it is set up to print somewhere CIDER doesn't look. Postponing the require to after CIDER is ready fixes all these issues. I would say this is a figwheel issue, not a CIDER-issue. Thanks for sparring with me, @vemv.

cider 1
magnars12:12:01

If I wanted CIDER to capture out and err earlier during startup, where would I start looking at the code? nrepl? cider-nrepl? Right now it takes a few seconds after startup before (java.util.logging.ConsoleHandler.) creates a handler that will output to the repl.