lsp 2025-09-30

Hello 👋 I'm using custom linters in my project. And the code for the linters lives there too. Is it possible to extract that into a library, so that I can use it in other projects? Any public repo that I can peek at for 'inspiration'?

nice! thank you 🙏

I think @franquito might be referring to the new LSP custom linters?

Yep, but the idea is more or less the same, I guess?

I'm sure the idea was inspired by what clj-kondo does, but they are not the same

oh crap, i didn't know lsp supported custom linters, my apologies

the file just has to be on the classpath: clojure-lsp.exports/linters/my_org/my_linter.clj

so it doesn't matter if it's in a library or in your local project

so the answer to your original question is: yes

right! I'm not familiar with writing libraries so I'll be checking Noah's code. thanks both of you!

Noah's code is about clj-kondo hooks, not about lsp custom linters

👍 1

Just make a directory with a deps.edn. Add your file in src/clojure-lsp.exports/linters/my_org/my_linter.clj . Add it to github. You have a library you can reference as {:deps {io.github.your-account/my-library {:git/sha "..."}}}

❤️ 1

you don't even have to add it to github. you can also reference it with {:deps {io.github.your-account/my-library {:local/root "../my-project"}}}

Yep 🤔 I'll go that way, since I'm still tweaking the code

👍 1

you might have to restart clojure-lsp before it finds this stuff

Answering the original question, yes, and we do that for nubank, having a common lein library that has all clojure-lsp custom linters + kondo hooks (called codestyle), so you could do the same. The lib must just be avaialble on classpath, usually in dev alias for clojure-lsp be able to use it

The custom linters page linked above references clj-depend which I navigated to and saw the following. Wth.

That's weird, @contato794 is the maintainer, maybe he knows

Just talked with @contato794 and fixed docs, the correct is https://github.com/fabiodomingues/clj-depend

👍 1

Just thought about a clojure-lsp doctor command which outputs the classpath used for analysis and any other relevant info which might help a lot debugging multiple issues 🤔

👍 8
2