Fork me on GitHub
#shadow-cljs
<
2020-07-24
>
thheller07:07:01

@colinkahn that is what :target is for. there could be a :target :goja. from the looks of it the output of :node-script release builds might just work?

colinkahn15:07:50

@U05224H0W thanks, I used the custom target example and got it working. Thanks again for an awesome tool!

gleisonsilva11:07:30

Hello, guys! Yesterday I've updated to 2.10.17. Then my setup with Vim Fireplace has stopped working. I can't no more connect to repl... has anyone experience that? Can help me?

Olical11:07:59

I've also lost completion support recently, so have other users of Conjure, we're seeing NPEs (will attach as snippet after this)

thheller11:07:55

apparantly its just disabled in cider now?

Olical11:07:25

Like, no cljs completion until it's fixed?

Olical11:07:41

Because Conjure handles it okay, I don't need to disable it. It's just failing in the background and saying there's no completions.

thheller11:07:57

completion still works I think. just the regular kind. so no completion for "live" JS objects

Olical11:07:08

Ah! So I can turn off that advanced flag

thheller11:07:28

I don't really know how any of it works since I don't use it

Olical11:07:11

No problem, I think it's enhanced-cljs-completion?, pretty sure I can just switch that off for now and it'll continue to work. Thank you so much for the insight.

neilyio21:07:06

I'd love a tip or two on reading the below stacktrace. I evaluated a function in the CIDER REPL, and got #object[Error Error: No protocol method ReadPort.take! defined for type null: ] . Then, I did a (tap> *e) in the REPL so that I could take a look at the :stack key on the object using the (amazing) shadow-cljs Inspect tool.

neilyio21:07:45

Here's what I see:

Error: No protocol method ReadPort.take! defined for type null: 
    at Object.cljs$core$missing_protocol [as missing_protocol] (/Users/neil/Desktop/loserCLI/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/cljs/core.cljs:318:3)
    at cljs$core$async$impl$protocols$ReadPort$take_BANG_$dyn_37176 (/Users/neil/Desktop/loserCLI/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/cljs/core/async/impl/protocols.cljs:13:1)
    at Object.cljs$core$async$impl$protocols$take_BANG_ [as take_BANG_] (/Users/neil/Desktop/loserCLI/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/cljs/core/async/impl/protocols.cljs:13:1)
    at Function.cljs$core$IFn$_invoke$arity$3 (/Users/neil/Desktop/loserCLI/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/cljs/core/async.cljs:99:1)
    at Function.cljs$core$IFn$_invoke$arity$2 (/Users/neil/Desktop/loserCLI/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/cljs/core/async.cljs:99:1)
    at cljs$core$async$take_BANG_ (/Users/neil/Desktop/loserCLI/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/cljs/core/async.cljs:99:1)
    at cljsEval (<eval>:1:36)
    at global.SHADOW_NODE_EVAL ([stdin]:105:10)
    at Object.shadow$cljs$devtools$client$node$node_eval [as node_eval] (/Users/neil/Desktop/loserCLI/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/node.cljs:11:1)
    at Object.shadow$cljs$devtools$client$shared$IHostSpecific$do_invoke$arity$2 (/Users/neil/Desktop/loserCLI/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/node.cljs:100:5)

neilyio21:07:39

I don't see any of the names of my own .cljs files on any of these lines, so I'm not sure where to start looking for the error. To be clear, I'm happy to debug the actual error on my own, I'd just love a tip for getting started.

thheller21:07:40

(<! something) where something is nil

neilyio21:07:07

Haha that certainly saves me some debugging time, thank you! I'll remember that particular error-cause relationship now, but do you think it would be useful for me to know how to parse this stack trace?

thheller21:07:44

No protocol method ReadPort.take! defined for type null <! is calling that protocol. the trace is basically just going from the helper fn through the entire implementation ending up at the protocol

thheller21:07:00

it starts with something you called from the REPL

thheller21:07:39

<! is also called take! basically

neilyio21:07:04

I guess what's throwing me off is that I don't see any of my own source files in the stack trace. I realize that it's probably hidden by all the compilation that's happening, but I was wondering if I should be configuring something to make them more clear.

thheller21:07:08

go block are rewritten pretty heavily so the stack traces often don't quite make sense

neilyio22:07:10

I see, so this unclear stack trace might be an issue I'll keep running into with core.async and go blocks. That helps me understand better, thank you once again.

thheller22:07:37

did you not trigger this from the REPL?

neilyio22:07:42

I did, yes.

thheller22:07:52

stacktrace looks like you did so there really is no "file" reference to show

neilyio22:07:59

Of course. One of those things that doesn't make sense until you publicly embarrass yourself with it. Is there a smarter way of evaluating my code that would help me see that "file" reference?

thheller22:07:42

what file reference do you want to see? the error was in the code you just eval'd? you know where that came from?

neilyio22:07:25

I just evaluated my main function, which calls a few other functions, and I just wasn't really sure where to start looking for the error.

neilyio22:07:38

But it sounds like the trick is just to evaluate smaller blocks of code at a time.

thheller22:07:16

I always just load the entire file and then sometimes code from (comment ...) blocks

neilyio22:07:19

Ideally, I would have liked to see the line in my app.main cljs file that contained the <! or the go block that I messed up on.

neilyio22:07:45

That's a good tip. Thanks for working with me through these rough spots.

thheller22:07:37

the shadow-cljs codebase is littered with these kinds of comments. usually I clean them up after a while but sometimes they just hang arround

thheller22:07:12

so in Cursive I just open that file and "Load file in REPL" and then place my cursor in that form and "Send form to REPL"

thheller22:07:42

pretty common workflow. others have made videos about that.

thheller22:07:59

I agree that things could be smarter in that each form sent to the REPL could contain a source location and Cursive does this in some way to Clojure

👍 3
thheller22:07:23

but thats mostly on the editors not sending the information and the REPLs not respecting or consuming it at all

neilyio22:07:04

Glad to hear I'm not entirely going crazy!