Fork me on GitHub
#calva
<
2021-08-03
>
Ar Nazeh13:08:22

I understand that there is a way for calva's linter (clj-kondo) to understand macros from reframe and other libraries, but I am not sure how!

Ar Nazeh15:08:54

Thanks, this worked for me

./.clj-kondo/config.edn

{:lint-as {day8.re-frame.tracing/fn-traced clojure.core/fn}}
But I had to restart VScode

👍 3
Tomas Brejla15:08:50

I noticed the same thing.. that I had to restart vscode before similar configuration got applied. Is that a bug or feature/limitation? Any idea, @UKFSJSM38 ?

ericdallo15:08:28

It's required to analyze the project again by clojure-lsp

Tomas Brejla15:08:52

I see. And that can currently only be achieved by restarting vscode, right?

Tomas Brejla15:08:13

I believe I saw some discussion about that recently.

ericdallo15:08:09

Yeah, but that support is for .lsp/config.edn changes, for clj-kondo configs probably that will not be entire true

pez16:08:23

It should be enough with reloading the VS Code window

ericdallo16:08:03

Actually depending on your clj-kondo config, it will work for next kondo run, editing a file or reloading the window

alpox17:08:48

Closing / reopening the file worked for me already

Tomas Brejla21:08:46

It didn't for me in recent past. Is there any scenario to retest?

alpox22:08:54

I can replicate that behavior still. @U01LFP3LA6P as a small example for a macro that would be linted wrongly is

(defmacro my-> [& body]
  `(-> ~@body))

(my-> 1 (inc))
The (inc) will be showing an error by kondo. If I add the lint-as in the config.edn, close the file with the macro usage and reopen it the error is gone.

ericdallo22:08:20

the error is gone when kondo run again which happens: • you edit the file • you close/re-open the file • you restart clojure-lsp, via reloading vscode windows or restarting vscode

🙌 2
alpox22:08:10

Oh true, just editing works :thinking_face:

Tomas Brejla22:08:48

I remember that httpkit's get macro forced me to restart calva after change to clj-kondo's config file. IMO it's just a small annoyance, but getting the config right is tricky as your feedback loop is broken.

Tomas Brejla23:08:50

Editing and/or closing of the affected file did bot help in my case

ericdallo23:08:45

if you changed something related to a external lib like http-kit, so probably you need to restart clojure-lsp indeed

alpox17:08:27

I just tried out - it works but on any evaluation it always outputs the whole "request" (I don't know exactly where from). Did somebody already encounter that?

alpox17:08:39

And even knows a way to prevent that from happening? 😄

Xarlyle022:08:16

Is there a way to make it so that when a namespace is loaded into the Calva Repl, every spec is automatically run through spec.test.alpha/instrument? I'm looking into spec.alpha and am looking for nice ways to integrate it with my development.

pez08:08:01

I don’t think so…

Xarlyle013:08:39

Darn. I thought there might be a way to run custom code on namespace load

pez14:08:46

There isn’t. You can run custom code on demand, though: https://calva.io/custom-commands/