This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-03
Channels
- # babashka (16)
- # beginners (70)
- # biff (1)
- # calva (15)
- # clj-commons (1)
- # cljsrn (1)
- # clojure (31)
- # clojure-android (1)
- # clojure-nl (4)
- # clojure-spec (17)
- # clojurescript (6)
- # cursive (3)
- # fulcro (22)
- # holy-lambda (21)
- # honeysql (20)
- # jobs-discuss (5)
- # kaocha (1)
- # lsp (51)
- # malli (1)
- # missionary (7)
- # nrepl (1)
- # off-topic (9)
- # portal (3)
- # reitit (1)
- # shadow-cljs (4)
- # xtdb (2)
How do Calva/clj-kondo/clojure-lsp work out which files to lint?
From my experiments, for my deps.edn
project, it seems as though it looks at the directories specified within :paths
but not any of those specified within :extra-paths
? Do I understand that correctly?
Why am I looking at this? I’m working on a Clojurescript application built with Figwheel Main. I have to put the generated target directory on the classpath so that it can be served to the browser, but if I do so by adding it to :paths
, I get literally thousands of warnings in Calva for those generated files. If I add it to :extra-paths
then I don’t?
@paulbutcher This is a clojure-lsp setting.
Right now, I just want to understand what is and what is not included by default. But yes, ultimately I want to stop it from linting generated files.
Is there any documentation which describes how project files are treated for linting?
you can check the settings here: https://clojure-lsp.io/settings/
Ah cool - exactly what I was looking for - thanks! I haven’t yet entirely grokked the relationship between clj-kondo and clojure-lsp and for some reason I was hunting for this in the clj-kondo documentation and didn’t think to look in clojure-lsp (blush).
they are very much related. clj-kondo does the analysis of the clojure code and then passes that information to clojure-lsp, so clojure-lsp can provide features based on that
I think that what you want to do is set ignore-classpath-directories
to true
in the Clojure LSP settings.
So I’m reading that documentation right now and I admit I’m not entirely sure I understand the relationship between :source-aliases
and :ignore-classpath-directories
? As I understand it :paths
and :extra-paths
add directories to the classpath? So if I set :ignore-classpath-directories
which directories will clojure-lsp lint?
I’ve been doing some experiments, and I’m definitely confused. :ignore-classpath-directories
seems to have no effect at all that I can see (I’m still getting warnings from the generated code when it’s set to true, and clojure-lsp is still parsing everything that’s in :paths
). Can someone help me understand what it actually does?
I definitely don’t have an accurate mental model of what’s going on here. I will see if I can get some clarity in #lsp Thanks!
Dear Calva friends: Here’s a VSIX for you to test. It adds babashka and nbb jack-in support. I haven’t tested on Windows yet and suspect problems there of course. But who knows, maybe it will just work? https://14932-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.214-1001-bb-jack-in-8340d2a5.vsix