Fork me on GitHub
#clj-kondo
<
2021-08-05
>
ericdallo17:08:34

@borkdude can we expose clj-kondo.core-impl/resolve-config in the public API? 🧵

ericdallo17:08:23

Since clojure-lsp public linters now lives in clj-kondo config, clojure-lsp needs to check that in other features like code lens which check that same config key

ericdallo17:08:51

exposing that would help a lot

ericdallo17:08:12

(Actually I'm using that impl ns ATM)

borkdude17:08:38

but the config is already part of run!, isn't this enough?

ericdallo17:08:03

but I don't need that config, I need the one in user project root or in the home one

ericdallo17:08:06

like the final config

borkdude17:08:22

the "final" config is the one in run!

borkdude17:08:29

it's the one that clj-kondo really used

ericdallo17:08:59

oh, yes, that would partially work, but I'd like to make something that doesn't need to restart the server, like check everytime to see if the config changed

borkdude17:08:39

so tell me, regardless of the impl function, "I need a function foo that given argument x returns y", then what would this be?

ericdallo17:08:30

something like (clj-kondo.core/config project-root) which brings the merged edn of home user clj-config + project clj-kondo config

ericdallo17:08:11

just making that impl public would work as I'm doing something like:

(defn kondo-config [db]
  (kondo.core-impl/resolve-config (io/file (:project-root-uri db)) {}))

borkdude17:08:49

sorry, you have to be more specific. the merged config is already in the output of run! so I don't understand what you're missing yet

ericdallo17:08:38

Sorry, let me try to be more specific • user has lsp running in a project • user change clj-kondo/.config of that project or its clj-kondo home dir config changing the :linters clojure-lsp/unusued-public-var setting, adding a exclude or something • next time clojure-lsp process code lens for that file, it will call this new function which would bring the config

ericdallo17:08:46

we could update the db with clj-kondo output of run!

ericdallo17:08:55

but that would need user to edit the file

ericdallo17:08:00

to clojure-lsp run kondo there

borkdude17:08:23

so you are watching these files?

ericdallo17:08:58

yeah, not really, you are right, the next time code lens need to be calculated kondo would run as well

ericdallo17:08:11

I'll use the output of run! and test if it works 🙂 thanks!

👍 3
ericdallo17:08:32

It worked perfectly 🙂

🎉 6