Fork me on GitHub

@borkdude Hi! I’m working on the integration of clj-kondo and clojure-lsp. I know that if I pass a directory to kondo then it’ll be able to see usages, etc. between files. But for LSP’s use case, I actually need kondo to lint the file that the user is currently editing (i.e. not on disk yet) together with those already written to disk. What will be a recommended way of doing that?


@cnly clj-kondo.core/run! accepts :lint which is a seq of paths


a path can be a single file or a directory, in which case all files in the directory will be linted (recursively)


If I pass e.g. ["src" "-"] to run! where I feed the current file in memory through stdin, kondo will see the on-disk version and the in-memory version of the current file at the same time.


True. Why do you want to lint them all at once btw?


The way it normally works is that the user edits a file, clj-kondo lints it and saves information to .clj-kondo/cache. Along the way it builds up more and more information about the linted files in the cache.


So you mean, we only need to lint the whole directory once, and then as the user edits a file, we just feed that single file to kondo, right?


And information about references between files will still be remembered and used?


Oh, cool. Let me try that. Thanks!


hi, not sure if this is in scope as a bug but core.async/go-loop appears to have a false positive; the first arg is for binding but I get an unresolved symbol x e.g.`(go-loop [x 1] x)`


@kevin842 Full repro please. Here it works fine.


yeah, you're right, the false positive is with me :) I had replaced clojure.core.async with just core.async somehow.


ok, no problem