Fork me on GitHub

Good morning, I'm trying "Evaluate form and replace result" but in my case I want to avoid the *print-length* limitation. I tried binding it to false but it doesn't work for Calva.


Not sure, but we could be using the calva.prettyPrintingOptions: maxLength option for this. There is no separate setting for that for the eval-replace case at least…


Thanks! The pretty-printing is nice otherwise it ends up in a huge line. I will try disabled it temporarily.


It worked 🙂


Setting maxLength to null should give you all the elements, but otherwise keep pretty printing things. Was that what you tried?


(That is, the form I'm trying to evaluate results in a big list, and I want that entire list printed out)


In attached image, I evaluate a form first in a clj repl, then I switch to a cljs repl and evaluate the same form again. The image features two unexpected things I regularly come across: 1. The prompt still says clj:... even though I switched to a cljs repl. I see this is actually the case even if I evaluate a purely cljs file (so can only connect to a cljs repl). 2. The result does not pretty print in the cljs repl. Are these issues or are my expectations wrong or I'm doing something wrong? Thanks!


Howe do you switch to a cljs repl?


Clicking on the switcher in the status bar.


I merged a PR that might fix that some days ago. We should release that fix.


About the pretty printing. I'm not sure if it is supposed to work. But if you switch to client side pretty printing, that should work. (The calva pretty print engine.)


> I merged a PR that might fix that some days ago. We should release that fix. Sorry, was running a previous version. Updating to the latest, don't have that problem anymore.


Ah, so maybe we have released it. 😂


> But if you switch to client side pretty printing, that should work. (The `calva` pretty print engine.) It does, thanks. So, when working in cljs I should manually change the setting to calva. When working in clj I switch back to pprint?


I use calva all the time.


Right, sorry. What I'm really asking is: is that the only way to switch back and forth between them?


But I actually don't know if the server side engines should work.


If it is something we can't expect to work we could make Calva always use client side for cljs.


The only way to switch engines is through settings. I think there are extension that make toggling settings convenient.

👍 1

Well, pprint works for me sometimes on the client side, but not always.


You could check the nrepl log and see if it has any clues.


I think it usually fails when there are tagged literals? Like in the image above.


Anyway, thanks for your kind and quick help!


Ah, yes, maybe when the data readers are not available to the JVM repl (where the nREPL server runs) it doesn’t work. On the Calva side of things that doesn’t matter, because it is all static.


Hey everyone! I'm wondering about repl-driven development in the frontend. I'm working with re-frame a lot and I was wondering how to integrate the repl here. Could you share some insight into your workflow?


Hello! I work with re-frame frequently lately. Can you describe what you mean by “integrate the repl”? What’s your JS/CLJS target? Is it a browser app, a nodejs app, a react-native app, something else (if there is)? In my case, with a react-native app, using shadow-cljs, I run Calva’s jack-in command and select shadow-cljs and the build I want to connect to. Once the repl starts, in order to evaluate code in the repl, your runtime needs to be connected. In my case, my runtime is my react-native app, running in an emulator (for example). Once the app is running, I can evaluate code from my editor, or from the repl prompt in the Calva output window.


Yes! This is exactly what I'm asking for. More specifically though, I'd like to know how you use the repl in actual development. I went through the calve hello_repl tutorial a couple of weeks ago and the stuff I learned seems cool. But I'm wondering if people actually use these things when hot reloading is already pretty immediate interaction.


Yes, it depends on what you’re trying to do perhaps, but the repl is still valuable even when using hot reloading. For example, I might pull in a library and want to test some calls using that library from the repl, without integrating the code into my app first.


Maybe I want to make direct http calls to some service to inpect the data I get back using the repl.


Or, I want to test a transformation with the repl before adding the transformation to my app code. For example:

(-> http-response


And then once I have the final form I want the data in for my app, I copy the code into some function used by the app.


That makes total sense, thank you!


You’re welcome!


Not sure if this is a question here or #clj-kondo, I have imported a lib ( that has a clj-kondo options for how to lint the macros, but when I use those macros they are not properly linted and clj-kondo report errors. Is there something I need to do/add for this to work?


@bertofer are you using the newest version of better-cond?


yes, 2.1.2


what is the code that doesn't work for you?


something like this:


hmm, is this better-cond.core/when-let?


can you paste a repro of this so I can try it locally?


yes, this is my import

(:refer-clojure :exclude [sorted-map sorted-map-by sorted-set sorted-set-by first last when-let])
  (:require [ :as avl]
            [better-cond.core :refer [when-let]])


have you upgraded clojure-lsp to the most recent one?


or: can you paste the clojure-lsp and clj-kondo versions?


How can I know them from calva/vscode?


also, check if there is .clj-kondo/better-cond/better-cond


if not, then the config isn't imported


This is something that @U0ETXRFEW might now (the versions)


also, check if there is .clj-kondo/better-cond/better-cond
if it should be inside my project’s clj-kondo, it isn’t


have you tried restarting your vscode?


well, that worked 😄


I am having another problem now, it seems it’s linting it as a normal when-let now:

  (:refer-clojure :exclude [when-let])
  (:require [better-cond.core :refer [when-let]]))

(when-let [a 1
           b 2]
  (println (+ a b)))
this tells me when-let should have exactly 2 forms


hmm, can you try {:lint-as {better-cond.core/when-let clojure.core/let}


in your own config


if that works, then this should be improved in better-cond


yes, that works


It seems better-cond config has a bug, here:

better-cond.core/when-let clojure.core/when-let


I can open an issue/pr if needed


done, was a bit delayed by my mess on local git credentials

Brian Alexander19:12:05

I'm new to Calva, fresh Vscode install, fresh Calva, fresh MacOS and I'm getting this weird bug where syntax highlighting doesn't update unless I close the file and reopen. Essentially the syntax highlighting is fixed to the line number and doesn't follow the actual code it refers to. Anyone seen this before?

Brian Alexander19:12:33

For example in this photo str has three different colors..

Brian Alexander20:12:19

If I open a directory with less files, it seems to work. Could be a file watcher issue? Coworker in same folder doesn't have the issue though


Could this be a semantic tokens issue, @UKFSJSM38 ?


yeah, sounds like a conflict of semantic highlighting and maybe some other plugin


Not sure it’s related, but you might see if it helps

Brian Alexander22:12:48

I rolled back the versions and 2.0.201 (6months ago) is working as expected. I also tested 2.0.211 (3 months) and it still had the issue. I'll try the above fix this later tonight and report back. Thanks!