LSP Unused Public Var -> Kondo Redundant Ignore
Hi! Thanks for Calva!!
With a tiny project like this:
deps.edn
{:paths ["src"]}
src/main.clj
(ns main) (defn foo [] 42)
foo is marked with an info alert:
"code": "clojure-lsp/unused-public-var", "source": "clojure-lsp",
I click on the light bulb and it adds this line before foo:
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
Now that new line is marked with an info alert:
"code": "redundant-ignore", "source": "clj-kondo",
Versions:
Calva 2.0.485 Last Updated 2025-02-02, 17:35:41 Calva Spritz 1.0.5 Last Updated 2025-02-02, 17:35:41 (Calva apparently installs this too, although I don't have LiveShare installed.) VSCode 1.96.4 Date: 2025-01-16T00:16:19.038Z Ubuntu 22.04.5 LTS
What am I doing wrong?
Thanks!
Hi!
Do you have the clj-kondo extension installed? If so, that could be the problem.
No, I don't have clj-kondo installed.
Can I do anything here to provide more info?
My two team mates have the same issue. And we don't have any special Calva config or anything. I suspect many users are having the same problem.
I suspect this is a clj-kondo issue. If so it is even more people affected. I could reproduce it in Calva with your description. Let's try repro it with clj-kondo alone:
~/Projects/tests/unused-public-var
❯ clj-kondo --version
clj-kondo v2025.01.16
~/Projects/tests/unused-public-var
❯ clj-kondo --lint src/main.clj
src/main.clj:3:3: info: Redundant ignore
linting took 18ms, errors: 0, warnings: 0
Yeah, clj-kondo. And it is probably new, because otherwise I would have heard of it before. 😄
Check if it is reported on clj-kondo, otherwise, please report it. Let's keep this issue open until we have a resolution or some more info about it at least.
I am assuming foo is some kind of API function? You could consider marking foo as exported, like so:
(defn ^:export foo [] 42)
That tells clj-kondo (and humans) not to complain about it not being used in the project.
Could you report to clj-kondo? If they start questioning me, I would just be a middleman relaying their questions to you.
Thanks for the ^:export tip! My problem is solved.
See this issue and this commit that's linked from that issue.
It doesn't look like the change linked above has been released yet judging by the time of that commit and the time of the last kondo release, but it seems the solution will involve updating the kondo config.