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

Should (prn my-map) be doing a pretty print in console? mine doesn't... #58

Open
mikew1 opened this issue Dec 16, 2020 · 1 comment
Open

Comments

@mikew1
Copy link

mikew1 commented Dec 16, 2020

Hi, I have cljs-devtools installed, I get the notification in the console that :formatters is active, and I sometimes see colored, formatted clojure data structures, but I was hoping that when I do (prn my-map) within some cljs source file, that would justify and color a large map. I'm just getting a regular print of the datastructure in the console, same as when cljs-devtools is not active. Am I doing something wrong? Thanks.

@mikew1
Copy link
Author

mikew1 commented Dec 16, 2020

Apologies, it was my lack of experience with cljs that was the issue here. Once I realised that studying the code in the screenshot on the docs page is absolutely crucial, I got it fine. My error was to be using prn instead of console.log (prn does print to the console after all!), but for the formatters to work, it seems it's essential to use .log js/console and not prn/println.

The only way I found this out was by carefully studying the code in the screenshot, as this isn't pointed out in the main text of the docs anywhere...

Would you like a pull request on the FAQ page adding a couple of lines to make it clear, (in the main markdown text), what exactly is being shown in the screenshot? This might reduce an occasional beginner's head scratching.

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

No branches or pull requests

1 participant