This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (6)
- # aws (1)
- # beginners (64)
- # boot (22)
- # calva (9)
- # cider (109)
- # clara (4)
- # cljs-dev (29)
- # clojure (112)
- # clojure-europe (2)
- # clojure-italy (6)
- # clojure-nl (3)
- # clojure-russia (215)
- # clojure-spec (80)
- # clojure-uk (13)
- # clojurescript (150)
- # code-reviews (3)
- # core-async (7)
- # cursive (37)
- # data-science (11)
- # datomic (76)
- # figwheel-main (6)
- # fulcro (56)
- # jobs (3)
- # jobs-discuss (22)
- # juxt (4)
- # off-topic (11)
- # pathom (16)
- # planck (5)
- # portkey (63)
- # re-frame (22)
- # reagent (3)
- # remote-jobs (1)
- # ring-swagger (5)
- # shadow-cljs (3)
- # testing (2)
- # tools-deps (6)
Q: is there a way to make pprint in the repl output window use colors? Since Aviso supports this, it seems like it might be possible
some background: I am a frequent user of the scope-capture lib which allows me to send forms to the REPL and there I get colors. Sometimes I want to just check a value using pprint and then I lose colors. It would be less keystrokes and easier on the eyes if pprint could do this too
I have a macro that vaguely resembles
defrecord, can I somehow tell cursive that it does so that it stops throwing “cannot resolve” erorrs?
I tried changing it via the light bubble menu thing to
defn, but no success and to
defrecord but also not happening
Its “syntax” looks like
(defmyrecordish [arg1 arg2 arg3] (fn [x] ... including refs to arg1 arg2 arg3 ...))
or .. otherwise, can I tell Cursive to give up on trying to find errors in particular codeblocks. Bit of a nuclear solution but eh.
It seems that many of the Fulcro macros are correctly interpreted, is there custom code for those?
@steveb8n Yes, the problem is that pprint works on the server, and Cursive just sees a bunch of output text. If rather than pprint’ing the result you just evaluate it, then Cursive will pretty-print and colour it for you.
i.e. instead of
(pprint x) you just do
x, then the value of x will be the result of the evaluation, and Cursive will do its usual pprint and colorise.
understood. I didn’t explain clearly. My use-case is that I add a pprint into some fn in the code path and then invoke that path via a test or repl etc. it’s that pprint output that is tough to read
but I understand the difficulty since those pprints are just strings into stdout, not in the result of the eval
I’m not wedded to pprint for this. if there was another util that would support colors, I would gladly use that
@steveb8n I would want it. But here's how I work around it: I use a function
tag> to "tag" a value to stdout. Of course, there's no colour there. But
tag> also conjes the value to a global list atom, which means I can pick and choose at the REPL which values I want to inspect in more detail.
although my goal here is too minimise keystrokes and in this case you will have to eval one more form to send the data from the global to the repl right? (I know I’m being pedantic)
@UF277CJ5P I tend to use the “scope-capture” lib for this. you should check it out, it’s so good!
Regarding your point above, I type (tv) at the REPL to see the most recent tagged value, rather than sending anything to the REPL.
See here for more: https://gist.github.com/gsinclair/2114f0f5155478e91f01bb155b8f808b
that is pretty sweet. You could even record an IDE macro to invoke the (tv) I suppose. thanks for chiming in 🙂
@lennart.buit There isn’t a good way to do this, no, unless the grammar of the form exactly matches some built-in one that Cursive already understands. Suppressing unresolved errors inside particular forms would work for local bindings but not for any global vars a form creates.
Fulcro has specific support in Cursive, because a lot of people use it, and also it was very easy to add because it looked like om-next, which Cursive already supported.
And its not possible to abuse Fulcro’s support? Because by sheer luck I can make my macro look like the ones from Fulcro :’).
Yes, in that case you can just use Resolve as… (see here: https://cursive-ide.com/userguide/macros.html) to do that. The doc is out of date there, there’s now a Specify… option which will allow you to select the Fulcro macro to resolve as.
haha, fantastic. Not sure whether (future) coworkers will appreciate that tho, I’ll stick with a less-fancy-more-traditional bunch-of-functions approach for now.
Well, it’s only likely to be a problem for future coworkers using Cursive, and if you register that customisation with your project they will see that too.
oh are they stored somewhere in config? May be worth versioning that file then. My companies clojure developers mainly use cursive
@lennart.buit Yes, go to Settings->Langs & Frameworks->Clojure->Symbol Resolution and set the Scheme to “Project”. Then those customisations will be stored in project files that can be versioned.
Cool, thanks! Given the - I can only assume - challenging Clojure language, you make a great tool.