-
-
Notifications
You must be signed in to change notification settings - Fork 53
Pretty view mode #335
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
Pretty view mode #335
Conversation
8681839
to
cd6109e
Compare
1e1d0a9
to
b4ee290
Compare
Thanks for putting in the work, @r0man! I left a few comments. |
src/orchard/inspect.clj
Outdated
(render-value val (when mark-values? | ||
{:value-role :map-value, :value-key key})) | ||
(render-ln))) | ||
(let [rendered-key (rendered-element-str (last (:rendered (render-map-key ins key)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not quite what I meant:) You can print the key with print-string
first. That gives you a string that you can check if it's long or has newlines and you don't have to dig it out of :rendered
list and parse it. And once you have a printed string, you can pass it to render-value
via :display-value
.
Another thing: even though it is a config option now, I think it will still be beneficial to have a |
Whoops, sorry for confusing you! I forgot that |
@alexander-yakushev No worries, I think what you describe in your last comment was my latest plan. Was your comment about adding the |
I think it is perfect as it is. Let's merge!
Yeah, I suggested this and then understood it is not necessary. |
Hello,
this PR adds the pretty printer from https://github.com/eerohele/pp (as suggested by @alexander-yakushev) and some of its tests, and a configuration option to toggle the pretty printing with the "P" key binding in the CIDER inspector.
The top level keys are rendered in the "inspector mode" as I understood it from a conversation on Slack.
The changes needed for the middleware can be found here: clojure-emacs/cider-nrepl#932
The changes for CIDER are here: clojure-emacs/cider#3813
The data structure shown on the following pictures was this:
Without pretty printing enabled (as before):
With pretty printing enabled (in normal mode):
With pretty printing enabled (in object mode):
Wdyt?
Open questions:
pp_test.clj
file.{...}
map after the record name) would be printed on a new line. Was the plan for the pretty printer to modify it for our needs?TODOs:
orchard.print-test
. They are passing in the REPL but fail when I run them withlein test orchard.print-test
in Leiningen. For some reason they are printed differently in Leiningen. Any idea why that is? The atom(atom 1)
for example is printed as"#atom[1 0x4f9ea948]"
in the REPL, but like this#object[clojure.lang.Atom 0x3a718b52 {:status :ready, :val 1}]
from Leiningen. I already checked that the various*print-XXX*
vars are bound to the same value. It seems they are. What else could affect the printing?Before submitting a PR make sure the following things have been done: