Skip to content
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

Syntax-highlight #inst and #uuid #975

Closed
mfikes opened this issue Jun 13, 2019 · 2 comments · Fixed by #987
Closed

Syntax-highlight #inst and #uuid #975

mfikes opened this issue Jun 13, 2019 · 2 comments · Fixed by #987
Assignees

Comments

@mfikes
Copy link
Member

mfikes commented Jun 13, 2019

image

Syntax highlight the strings that follow #inst and #uuid.

@pyrmont
Copy link
Contributor

pyrmont commented Jun 14, 2019

Did you have an idea for the appropriate colours?

@mfikes
Copy link
Member Author

mfikes commented Jun 14, 2019

@pyrmont Yeah, I was thinking that the strings would simply be rendered in the same color that strings currently get rendered as. (I'm color blind... assuming it is green.)

But, the solution is probably just an extra branch or two in here for these types

(visit-unknown [this x]
(cond
(instance? Atom x)
(pretty-coll this "#object [" ['cljs.core.Atom {:val @x}] :line "]" visit)
(instance? Volatile x)
(pretty-coll this "#object [" ['cljs.core.Volatile {:val @x}] :line "]" visit)
(instance? Delay x)
(pretty-coll this "#object[" ['cljs.core.Delay {:status (if (nil? (.-f x)) :ready :pending),
:val (.-value x)}
] :line "]" visit)
(satisfies? IPrintWithWriter x)
(visit-default x)
(instance? Eduction x)
(if print-length
(fipp.visit/visit-seq this (into [] (take (inc print-length)) x))
(visit this (sequence x)))
(array? x)
(pretty-coll this "#js [" x :line "]" visit)
(object? x)
(let [kvs (map (fn [k]
[(cond-> k (some? (re-matches #"[A-Za-z_\*\+\?!\-'][\w\*\+\?!\-']*" k)) keyword)
(gobj/get x k)])
(js-keys x))]
(pretty-coll this "#js {" kvs [:span "," :line] "}"
(fn [printer [k v]]
[:span (visit printer k) " " (visit printer v)])))
:else
(visit-default x)))

@mfikes mfikes self-assigned this Jul 6, 2019
mfikes added a commit that referenced this issue Jul 6, 2019
mfikes added a commit that referenced this issue Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants