Fork me on GitHub
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


{:lint-as { 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 ?


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.


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


It should be enough with reloading the VS Code window


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


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?


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.


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

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


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


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?


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


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.


I don’t think so…


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


There isn’t. You can run custom code on demand, though: