lsp 2024-10-16

After trying in #clj-kondo and #calva channels rerouting this question here. Hopefully this is finally the correct location for help. I would like to get rid of linting the sources that are copied to .clj-kondo directory in my project which cause quite many warnings etc that are not of concern to me.

clojure-lsp indeed tells clj-kondo to copy those files, but that's not the problem. The weird thing is clojure-lsp linting that folder because clojure-lsp only lint the following: • a classpath during open of the project, so lint your src and test folders • any clojure related file you open in your editor. Did you open any of those files manually? try closing everything, opening the project again. Also you don't need that :output config in your clj-kondo config or those regex in lsp config

My classpath does include my ~/.m2 directory which maybe the reason since if I have understood correctly clojure-lsp tells clj-kondo to copy library specific clj-kondo configs and that particular dependency may be the source for this. dtype-next has this .clj-kondo https://github.com/cnuernber/dtype-next/tree/master/.clj-kondo

{:config-paths ["../resources/clj-kondo.exports/cnuernber/dtype-next/"]}
That https://github.com/cnuernber/dtype-next/tree/master/resources/clj-kondo.exports/cnuernber/dtype-next then contains actual source code in addition to clj-kondo config

every classpath has dependencies from .m2, probably not the problem

Those source files end up in my .clj-kondo directory where they get linted with lots of warnings

yes, it's expected to have code, it's what clj-kondo hooks is

the problem is the get linted

because clojure-lsp only lint if the .clj-kondo folder is in the classpath

or you opened that file

could you try to repro in https://github.com/ericdallo/clojure-sample ? if master is not enough you can try create a new branch or so

That sample project opens up nicely

so this must be related to my project, which, I have to admit, is quite large and old 😅

I'm not sure if that project has a clj-kondo hook which has diagnostics tho

try adding the deps that have the hooks you have in your project

👍🏻 1

Can't reproduce. I see the same sources copied to .clj-kondp directory but they do not get linted. It must be my project, which is over 3yrs old and has seen quite many spikes and pocs with different libs.

yeah, I suspect something is opening that file in your vscode, try cleaning any vscode/calva related cache folder

I deleted .clj-kondo directory, restarted both VS Code and clojure-lsp and it puff, problems gone. The .clj-kondo directory is differently organized now tho 🤔 note the imports folder which now contains all copied code.

and the culprit dtype-next library is gone.

picard-facepalm oh well

interesting, didn't know that imports folder

but glad it's fixed :)

Must be some new clj-kondo magic that depends on the format of .clj-kondo directory, maybe version specific features

👍 1