Fork me on GitHub

@suskeyhose it's been released


Q: so I'm using http-kit.client and it uses a macro to define a bunch of functions like put, get, post, etc in terms of a generic request function -- and clj-kondo is reporting http/post etc in my code as unresolved. Is there a way to tell it about those vars defined via macros?


I've run into the same issue with http kit, and with an internal library that creates functions in a macro.


I wonder if it would be possible to an analyze-call for the creating macro and turn it into a bunch of defns


Usually you can solve this using :lint-as


(this seems to be the first time I've managed to get LSP/clj-kondo to fully rescan our source code in a long while -- see my struggles in #lsp for that)


@seancorfield Yeah, you can use {:lint-as {org.httpkit.client/defreq clojure.core/declare}} and then re-scan your project


This config can also be contributed back to the library using config exports/imports


@seancorfield You can force re-scanning your project by removing .lsp/.cache and then re-opening your editor, or does clojure-lsp automatically re-scan your project upon config changes @ericdallo?


I thought I could just change deps.edn to force a rescan but that doesn't seem to have done it (I temporarily added the http-kit dep directly to the project deps.edn file -- it's just a transitive dep via :local/root otherwise) but I suspect LSP thinks it has already scanned http-kit...?


That seems unfortunately brutal but I guess it'll work 🙂


@seancorfield Perhaps @ericdallo has a less brutal way ;)


Yeah. Rebuilding the entire cache worked. It would be unfortunate if that's the only option after updating clj-kondo's config.


If you change your deps file, clojure-lsp should certainly scan the project but only in the next startup, not automatic


about updating the clj-kondo config there is this issue:


@ericdallo clj-kondo already has a hashing function for internal use to ignore already linted deps when the config has changed


Would you mind sharing the function on the issue please?


perhaps you can use it for inspiration


Oh, nice! Glad to know there's an issue. Also, good to know that if deps.edn changes, clojure-lsp will rescan at next startup -- I had hoped it would kick off a scan once the file changed... is there a way to "force" (encourage) clojure-lsp to rescan without restarting/reloading the editor? (I'm using VS Code/Calva if it makes a difference)


I would also like to have this in emacs


@seancorfield fwiw, a lot of libs are already providing config for clj-kondo. these are some examples: these configs are automatically imported by clj-kondo into the .clj-kondo directory when lsp indexes your deps, but you should still "opt in" to them by editing your deps.edn . if you have any libraries with macros that need config, you can consider doing the same and it will just work for anyone who uses your libraries.


there is lsp-workspace-restart for emacs, but for vscode I think only the reload window is available


ah is that it, yeah I've been using that, thanks


@borkdude Thanks. I probably ought to look at how clj-kondo views my various libraries and go ahead and do that "properly" for them...