calva icon indicating copy to clipboard operation
calva copied to clipboard

False positive errors in Calva when using potok streams

Open EvaMarco opened this issue 10 months ago • 4 comments

Hi! In our project, we use potok to manage streams, so we have many functions that follow this pattern.

However, in Calva we are seeing errors reported for each of these cases, even though the code is valid. Here's an example:

` (defn finalize [] (ptk/reify ::finalize ptk/UpdateEvent (update [ state] (dissoc state :viewer))))

` In Calva, this shows an error like the one in the attached screenshot:

Image

We tested the same code with clj-kondo directly and it does not report any errors. So it seems like this might be related to how Calva is integrating clj-kondo or how it's configured.

Could this be a configuration issue? Have you seen something like this before? Any suggestions on how we could get rid of these false positive errors?

Thanks a lot for your help, and thanks for the great tool!

EvaMarco avatar Apr 23 '25 07:04 EvaMarco

Hi! This is quite strange.... Calva integrates with clj-kondo only secondary via clojure-lsp. I would try see if running clojure-lsp in the project reports anything.

PEZ avatar Apr 23 '25 12:04 PEZ

In addition to the error, we have these info messages

Image

EvaMarco avatar Apr 24 '25 15:04 EvaMarco

The issue is due to the clj-kondo hook used in penpot. It uses a local atom as symbol registry to detect duplicates. This is fine when clj-kondo passes only once over each file, but I suspect that clojure-lsp's embedded clj-kondo does not start its clojure interpreter anew nor reset its state before parsing files a second time.

So I'm not sure this is a calva issue. Nevertheless, emacs users do not experience this problem, and yet they also run clojure-lsp so maybe there's some configuration that tells it to reset internal state before each pass or something like that?

mdbenito avatar Jun 18 '25 12:06 mdbenito

Thanks for the update. Seems like if it works in emacs it is strange that Calva has problems with it. Do you have any ideas on this, @ericdallo ?

PEZ avatar Jun 19 '25 20:06 PEZ