This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-15
Channels
- # announcements (51)
- # beginners (65)
- # calva (44)
- # cider (6)
- # clara (3)
- # clj-kondo (30)
- # cljsrn (5)
- # clojure (63)
- # clojure-australia (7)
- # clojure-dev (7)
- # clojure-europe (43)
- # clojure-gamedev (1)
- # clojure-nl (6)
- # clojure-uk (7)
- # clojurescript (51)
- # conjure (1)
- # cursive (9)
- # datascript (16)
- # datomic (14)
- # depstar (20)
- # events (1)
- # exercism (17)
- # figwheel-main (6)
- # fulcro (9)
- # graphql (3)
- # gratitude (2)
- # honeysql (4)
- # jobs (7)
- # leiningen (3)
- # lsp (107)
- # meander (7)
- # minecraft (3)
- # off-topic (16)
- # other-languages (4)
- # pathom (4)
- # pedestal (26)
- # practicalli (4)
- # re-frame (3)
- # reitit (7)
- # remote-jobs (1)
- # shadow-cljs (26)
- # tools-deps (67)
- # vim (19)
- # vscode (1)
@suskeyhose it's been released
awesome
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 defn
s
(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: https://github.com/clojure-lsp/clojure-lsp/issues/331
@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? https://github.com/clojure-lsp/clojure-lsp/issues/331
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)
@seancorfield fwiw, a lot of libs are already providing config for clj-kondo. these are some examples:
https://github.com/clj-kondo/clj-kondo/issues/1383
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
@borkdude Thanks. I probably ought to look at how clj-kondo views my various libraries and go ahead and do that "properly" for them...