Fork me on GitHub
#cider
<
2020-06-25
>
neilyio01:06:43

Is there a better way to view Clojurescript error messages in CIDER? It's very awkward to have long messages like this printed out in the REPL, with no formatting or text wrapping. Even worse, they all just pile up before the empty prompt so it's very difficult to visually separate them. There must be a better way than this... Is there an option to have a properly formatted buffer pop-up? I'm using shadow-cljs.

dpsutton01:06:55

I’ve never seen errors like that

dpsutton01:06:24

Is there an actual error in your project? The auto complete has been a bit iffy with shadow. So perhaps it is that?

neilyio01:06:56

This particular error is indeed an unusual one... I'm getting a INTERNAL COMPILER ERROR after npm install --save jimp and using :require ["jimp" :as jimp] as you can see on the left hand side of my window. That's definitely something I'll bring up in #shadow-cljs, but right now all my compilation errors print out like this. Is this normal?

dpsutton01:06:38

I thought I remembered clickable errors in the repl for cljs

dpsutton01:06:29

I’d be interested to see a more traditional null pointer or whatever. I almost never look in the repl for stack traces since they are in the browsers console

neilyio01:06:31

It'd be great to clarify my understanding on this, which is that: 1. Successfully compiled ClojureScript will show errors from the generated JavaScript in the browsers console, and the browser's console is the best place to watch for those errors- not anywhere in CIDER or Emacs. Is that right? 2. If the ClojureScript cannot compile properly (syntax error, etc), it prints out an error message in the REPL in CIDER just below the previous output (with no formatting or text wrapping). The only way to watch for and read those error messages is to scroll up and down in the CIDER REPL. This is how I currently read errors that pop up from a shadow-cljs hot reload upon saving changes in a file. This is also what I'm hoping to find a better solution for.

neilyio01:06:56

I do find that, sometimes and for certain errors, my localhost:8080 in the browser will show a nicely formatted message from shadow-cljs that identifies a compilation error. But most of the time, it just prints it out in the repl and leaves an outdated version of the app showing in the browser, sometimes with a message like "shadow-cljs - The Websocket Connection was closed!"

neilyio01:06:33

I really do feel like I'm doing something wrong, because I've heard so many good things about this CIDER/ClojureScript/shadow-cljs developer experience in the inconsistencies here are very frustrating. If someone can point me in the right direction, I'd love to turn the knowledge into a comprehensive blog post for beginners.

❤️ 3
dpsutton01:06:46

I’m sorry you’re having issues with non compiling code. I expect the browser console and the browser heads up display from shadow might have better information?

dpsutton01:06:10

This is probably a weak spot of cider but I suspect it is nicer for “regular” errors

neilyio01:06:46

Oh, I'm just letting off some steam I guess. It's been much harder than I thought to get into a flow with these tools... There's a lot of complexity in the ClojureScript environment to wrap your head around when you're brand new to it. I really appreciate your getting back to me so quickly.

neilyio01:06:37

If you have a syntax error in your ClojureScript, like a missing bracket, where do you usually find out about it? In the REPL? I don't think those errors make it to the browser console, do they?

dpsutton01:06:54

Yeah that’s true

dpsutton01:06:18

I almost never have those. But the hud in the browser is where I’d expect to see it

neilyio02:06:17

Guess I'll just have to turn on strict parens. Thanks!

dpsutton02:06:35

Oh yeah. I wouldn’t edit clojure without structural editing

🎉 3
David Pham04:06:00

Smart parens is golden. It changed the way I code for sure.

👍 3
David Pham04:06:59

@neil.hansen.31 did you use the ^dev/after-load metadata for shadow-CLJS? Usually a function wrapping dom/render entry point will be called every time you update your files.

neilyio20:06:02

That is something I'm using now, but it took me a little too long to find out about. The shadow-cljs user guide is very thorough, but as a beginner (to Clojure and shadow-cljs), it made my head spin. After I've wrapped my head around all this, I'd love to eventually help with the creation of some more beginner friendly materials.

bozhidar10:06:55

If someone wanted auto-trimming of their REPL buffers you can check out https://docs.cider.mx/cider/repl/configuration.html#auto-trimming-the-repl-buffer

solf13:06:03

Love it!

dpsutton12:06:57

> REPL shortcut trim. chefs_kiss.jpg