Fork me on GitHub
#clj-kondo
<
2020-08-04
>
cnly07:08:02

@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?

borkdude07:08:28

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

borkdude07:08:57

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

cnly07:08:32

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.

borkdude07:08:57

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

borkdude07:08:53

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.

cnly07:08:40

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?

cnly07:08:36

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

cnly07:08:54

Oh, cool. Let me try that. Thanks!

kevin84218:08:20

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)`

borkdude20:08:20

@kevin842 Full repro please. Here it works fine.

kevin84220:08:24

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

borkdude20:08:13

ok, no problem