New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cider-pprint-eval-last-sexp
from a cljs
repl on a value which contains a #js literal formats eveything on one line.
#3534
Comments
Thanks! I'll investigate. Btw, Cheers - V |
Thanks, but I'm not quite sure how to upgrade to a particular version making peace with |
Thanks for the hint! After a new round of bugfixes I'll ping the Doom and Spacemacs maintainers. |
Hi, I'm experiencing this behavior as well. I've been experiencing this behavior for at least a year, but only recently has it become a big problem as I've been dealing with a lot of My versions: CIDER
Emacs
|
Is it a problem because the long lines slow down emacs? |
No, it's quite fast. It's a problem because it makes it hard to see and understand the |
Possibly related:
I tried all the suggestions noted in both of these issues, and I still can't get emacs/cider to pretty-print results with shadow-cljs when there is a "#js" in the output. When there is not a "#js" in the output, it pretty-prints fine. I'd love to help debug this, but I don't understand the responsibilities of the different tools involved: emacs cider, nrepl, shadow-cljs, etc. When using |
Thanks for the hints! A bare I've asked here where in cljs is that defined: https://clojurians.slack.com/archives/C07UQ678E/p1708856848465549 If it is something like a |
...I reckon that we can't/shouldn't change or override cljs behavior globally. But probably, somewhere in cider code we perform a prn or pr-str. We could avoid that if we detected that the object is a js object, and use a custom impl instead. |
Note that our default pprint option is: https://github.com/clojure-emacs/cider-nrepl/blob/3824d72f9ba1a14f9ce9910500db0885f6b39c23/src/cider/nrepl/pprint.clj#L42-L47 Many nrepl messages attach these k-vs:
You can customize these Elisp side with: Line 280 in dc58ed1
I hope these give you a baseline to play with! Best-case, you'd be able to detect what's wrong with our pprint and either fix it locally, or propose a PR. |
In the case where the result has a tagged literal in it, I don't think either Note I have observed that this happens with any tagged literal, not just |
Thanks! We'd have to check how shadow-cljs integrates with cider-nrepl which is bit of a dense area. It's mainly implemented in https://github.com/thheller/shadow-cljs/blob/a496c6febd36a7e9e6919180796f9ace81ff98e0/src/main/shadow/cljs/devtools/server/nrepl.clj
|
For posterity, here's the nrepl-level interaction:
|
One last note, shadow-based nrepl eval is defined here https://github.com/thheller/shadow-cljs/blob/a496c6febd36a7e9e6919180796f9ace81ff98e0/src/main/shadow/cljs/devtools/server/nrepl_impl.clj#L322 It may be that that bespoke eval doesn't happen to listen to the |
Oooooooo I think you got it! In that file, it tries to call read-string, and if that fails it returns the unread string: Indeed, I'm fairly certain this is the issue. THANK YOU! I'll file an issue on shadow-cljs. |
Cheers, yes, I think the same |
@vemv my PR was accepted to shadow, you can close this issue. Thank you again for the help! Locating that nrepl_impl.clj file was the key :). |
Awesome, that was quick! I'll verify it works + document the new min expected Shadow version, then close. Cheers - V |
Great work both 🙌 |
Expected behavior
Pretty printing should work even when #js literal is included.
Actual behavior
Whenever I run
cider-pprint-eval-last-sexp
from acljs
repl on a value which contains a #js literal everything is formatted on one line.Steps to reproduce the problem
Connect to
shadow-cljs
repl.produces
Environment & Version information
CIDER version information
Lein / Clojure CLI version
Emacs version
Operating system
Mac OS 13.0.1 (22A400)
JDK distribution
https://clojurians.slack.com/archives/C0617A8PQ/p1674417453437479
The text was updated successfully, but these errors were encountered: