Fork me on GitHub
#cursive
<
2022-09-17
>
genekim00:09:47

@borkdude Well, wow. I was so inspired by the “binaural beats” project, that uses scittle to enable using ClojureScript in <script> tags, that I’m attempting to modify a Chrome Extension that scrapes my order information from a http://amazon.com, which was written in JavaScript. (By someone on Upwork, who has since disappeared!) https://clojurians.slack.com/archives/C8NUSGWG6/p1663273758784879?thread_ts=1663232347.793979&amp;cid=C8NUSGWG6 I’ll have some proposed doc changes, or at least a writeup of my experiences trying tog et a simple “hello, world” app running. But I’m having a strange problem connecting to the browser nREPL, which is preventing big leaps in progress. Here’s what I’m seeing in my REPL session inside of Cursive. 1. Anyone have any ideas how I can make these REPL errors go away? I used used Cursive “create remote REPL session”, port 1339. It executes the forms, but I always get these errors. 2. less big of a deal: “Executing this form” inside of a comment always sends the entire comment form to the REPL session, instead of just the one form. Thank you all — I am really quite excited by the idea of writing these 10-50 line programs inside of html files!

(.-innerHTML q)
=> "Read <a href=\"index.html\">the main page</a> for more details."
Error updating completions:
"#error {:message \"Could not resolve symbol: cursive.repl.runtime/completions\", :data {:type :sci/error, :line 1, :column 1, :message \"Could not resolve symbol: cursive.repl.runtime/completions\", :sci.impl/callstack #object[cljs.core.Volatile {:val ({:line 1, :column 1, :ns #object[Ao bookmarklet], :file nil})}], :file nil, :phase \"analysis\"}, :cause #error {:message \"Could not resolve symbol: cursive.repl.runtime/completions\", :data {:type :sci/error, :line nil, :column nil, :file nil, :phase \"analysis\"}}}"Error updating completions:
"#error {:message \"Could not resolve symbol: cursive.repl.runtime/completions\", :data {:type :sci/error, :line 1, :column 1, :message \"Could not resolve symbol: cursive.repl.runtime/completions\", :sci.impl/callstack #object[cljs.core.Volatile {:val ({:line 1, :column 1, :ns #object[Ao bookmarklet], :file nil})}], :file nil, :phase \"analysis\"}, :cause #error {:message \"Could not resolve symbol: cursive.repl.runtime/completions\", :data {:type :sci/error, :line nil, :column nil, :file nil, :phase \"analysis\"}}}"

genekim00:09:24

Just in case it’s helpful, here’s a screenshot of REPL settings.

genekim00:09:00

…and here’s what shows up in babashka serving up the REPL session:

:msg "{:err \"\\\"#error {:message \\\\\\\"Could not resolve symbol: cursive.repl.runtime/completions\\\\\\\", :data {:type :sci/error, :line 1, :column 1, :message \\\\\\\"Could not resolve symbol: cursive.repl.runtime/completions\\\\\\\", :sci.impl/callstack #object[cljs.core.Volatile {:val ({:line 1, :column 1, :ns #object[Ao bookmarklet], :file nil})}], :file nil, :phase \\\\\\\"analysis\\\\\\\"}, :cause #error {:message \\\\\\\"Could not resolve symbol: cursive.repl.runtime/completions\\\\\\\", :data {:type :sci/error, :line nil, :column nil, :file nil, :phase \\\\\\\"analysis\\\\\\\"}}}\\\"\", :id \"a4c7a151-0844-4908-87f0-14d9b1a5996e\", :session \"d130a53e-3b69-48fa-8e09-23ab6295b104\", :ns \"bookmarklet\"}"
:msg "{:ex \"\\\"#error {:message \\\\\\\"Could not resolve symbol: cursive.repl.runtime/completions\\\\\\\", :data {:type :sci/error, :line 1, :column 1, :message \\\\\\\"Could not resolve symbol: cursive.repl.runtime/completions\\\\\\\", :sci.impl/callstack #object[cljs.core.Volatile {:val ({:line 1, :column 1, :ns #object[Ao bookmarklet], :file nil})}], :file nil, :phase \\\\\\\"analysis\\\\\\\"}, :cause #error {:message \\\\\\\"Could not resolve symbol: cursive.repl.runtime/completions\\\\\\\", :data {:type :sci/error, :line nil, :column nil, :file nil, :phase \\\\\\\"analysis\\\\\\\"}}}\\\"\", :status [\"error\" \"done\"], :id \"a4c7a151-0844-4908-87f0-14d9b1a5996e\", :session \"d130a53e-3b69-48fa-8e09-23ab6295b104\", :ns \"bookmarklet\"}"

cfleming00:09:18

So I think this is a problem in Cursive which was discussed recently (messy on Twitter): https://twitter.com/jackrusher/status/1525092640286560258

genekim00:09:17

Ha! Thank you, @U0567Q30W — I saw that on Twitter, and filed that away as, “sounds academically interesting, but I doubt it will ever affect me.” 😆

cfleming00:09:44

Sadly, famous last words.

cfleming00:09:52

I’ll try to get the generic completion into the next EAP build.

genekim00:09:43

Seriously, I’m reading the discussion with avid interest, but also telling myself, this is like reading the standards for floating point numbers. (ala, super important to make the world work, but in the domains of control vs. influence vs. concern, this is definitely under “concern,” like the weather. I am in awe of the people on the thread who are actually in control of this stuff!

genekim00:09:50

Thanks so much for explaining this, @U0567Q30W — eager to see what y’all come up with!

cfleming00:09:36

The TL;DR is that Cursive tries to sniff the REPL server type, and falls back to assuming JVM Clojure if it can’t work it out. It should really fall back to something more generic than that, which nREPL supports but Cursive doesn’t take advantage of.

genekim00:09:46

Just curious: what causes the second issue, of “send current form to REPL” to send not one form, but the entire comment form?

genekim00:09:00

PS: Holy cow. “(nREPL, socket REPL, direct IDE eval, debug REPL etc)“. 😆 My apologies if laughing isn’t quite appropriate, but yow, this stuff is complicated!

cfleming01:09:13

Yeah, it really is, and CLJS adds an entire new dimension to the matrix (browser, node, things like scittle and nbb)

cfleming01:09:47

The comment form thing is interesting. Is this in a CLJS file?

cfleming01:09:40

One workaround is to select the form you want to send, send to REPL will always use the selected form if any before deciding which to send if nothing is selected.

cfleming01:09:03

It’s a bit crap, obviously, it would be better to figure out why your comments aren’t working.

genekim01:09:07

Yes — CLJS to bb, as per here: https://github.com/babashka/scittle/tree/main/doc/nrepl at first I didn’t think anything was getting evaluated, but I noticed it was sending entirety of (comment … ) form.

cfleming01:09:54

In your source file, is comment being resolved properly? i.e. it’s not highlighted, and you can get doc and so forth from it?

genekim01:09:56

No worries for now — I’ll send you a movie of this happening, with more of the context. May not be for a week or two. Hardly urgent. Thanks as always!

genekim01:09:02

Oh! That’s interesting! You’re right — nothing was highlighted correctly. Like defn everything not being highlighted. Cursive didn’t show the “add source root?” message, either. I’ll show you in the movie the repo, deps.edn file, bb.edn file. and all the strangeness. I’m sure the details will illuminate, versus my vague descriptions!

cfleming01:09:49

Ok, thanks! Or just a repro repo on github would be good, then I can check it out and try it myself.

cfleming01:09:07

Not sure if that’s more or less work than the movie…

genekim01:09:36

Roger! Have a wonderful weekend!

cfleming01:09:49

Thanks, you too!

roklenarcic11:09:05

When using :as-alias in cljs files, the require with as-alias for non-existing namespace will cause all requires above it to appear invalid:

roklenarcic11:09:50

same thing in clj file:

cfleming21:09:51

I’ll check that, thanks.