Fork me on GitHub
#babashka
<
2023-09-18
>
Christian Pekeler09:09:31

I have a clj/cljs project with src, test, bin, and bb folders. In bin are a few babashka scripts, and in bb/our-company/some-theme/… is babashka code shared by the scripts in bin. Everything works fine except I can’t figure out how to configure .clj-kondo/config.edn to make lsp understand that the functions under bb are used by scripts in bin, i.e. I’m getting a lot of “Unused public var” warnings for the code under bb. The other direction works fine, i.e. there are no “Unresolved var” lsp warnings in the scripts in bin. Does anybody have any idea how this could be solved?

1
borkdude09:09:17

@UDQE4G9B2 Have you got a bb.edn file?

Christian Pekeler09:09:47

Yes, and it starts with

{:paths ["bb"]

borkdude09:09:10

looks good, I think lsp should be able to pick up on that. did you restart your lsp server already?

borkdude09:09:27

else let's ping @UKFSJSM38 , perhaps he knows

Christian Pekeler09:09:08

yes, restarted several times while trying different variations of :include-files in kondo’s config.

borkdude09:09:23

that doesn't affect lsp

borkdude09:09:46

lsp just scans your deps.edn + bb.edn files I believe

1
borkdude09:09:47

you can also check with clojure-lsp-server-info (if you're using emacs) to see what it's using

Christian Pekeler09:09:05

I’m in VSCode with Calva

borkdude09:09:39

> Note that it's possible to have more than one project type at the same time e.g. deps + babashka, clojure-lsp will merge the classpath and everything should work fine.

Christian Pekeler09:09:40

I have found the lsp-server-info in Calva, and it includes:

…
"final-settings": {
    "auto-add-ns-to-new-files?": true,
    "document-formatting?": false,
    "dependency-scheme": "jar",
    "keep-require-at-start?": true,
    "source-paths": [
      "/Users/pekeler/Projects/redsky/redsky/bb",
      "/Users/pekeler/Projects/redsky/redsky/src/clj",
      "/Users/pekeler/Projects/redsky/redsky/test",
      "/Users/pekeler/Projects/redsky/redsky/src/cljc",
      "/Users/pekeler/Projects/redsky/redsky/resources",
      "/Users/pekeler/Projects/redsky/redsky/src/cljs"
    ],
…
i.e. the bin folder seems to be missing.

borkdude09:09:21

perhaps add it to paths in bb.edn?

👍 1
Christian Pekeler09:09:39

That was it 😄 Thank you very much for your super fast help!

borkdude09:09:08

Sure thing. cc @UKFSJSM38 - problem solved.

👍 1
ericdallo11:09:40

Just out of curiosity, does bb has default paths? I think deps.edn has src as default

borkdude11:09:19

bb doesn't have default paths, I decided to not add src since it would then often conflict with clojure projects

👍 3
borkdude20:09:07

clojure-spin 3
docker 2
😎 2
🚀 1
nice 2