I have noticed that clojure-lsp diagnostics have been disappearing from certain files in neovim. I wasn't certain if the problem was with my neovim setup or clojure-lsp, but after a bit of investigation I have been able to reproduce the issue using the cli. clojure-lsp throws the following exception when interop calls are present in the analyzed namespace:
[ 99%] Project analyzed Finding diagnostics...
Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: No matching clause: :on
at java.base@21.0.5/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base@21.0.5/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at clojure.core$deref_future.invokeStatic(core.clj:2317)
at clojure.core$future_call$reify__8574.deref(core.clj:7121)
at clojure.core$deref.invokeStatic(core.clj:2337)
at clojure.core$deref.invoke(core.clj:2323)
at clojure.core$map$fn__5954.invoke(core.clj:2770)
at clojure.lang.LazySeq.force(LazySeq.java:50)
at clojure.lang.LazySeq.lockAndForce(LazySeq.java:60)
at clojure.lang.LazySeq.sval(LazySeq.java:69)
at clojure.lang.LazySeq.unwrap(LazySeq.java:77)
at clojure.lang.LazySeq.realize(LazySeq.java:93)
at clojure.lang.LazySeq.seq(LazySeq.java:106)
at clojure.lang.RT.seq(RT.java:555)
at clojure.core$seq__5486.invokeStatic(core.clj:139)
at clojure.core$filter$fn__5981.invoke(core.clj:2826)
at clojure.lang.LazySeq.force(LazySeq.java:50)
at clojure.lang.LazySeq.realize(LazySeq.java:89)
at clojure.lang.LazySeq.seq(LazySeq.java:106)
at clojure.lang.RT.seq(RT.java:555)
at clojure.core$seq__5486.invokeStatic(core.clj:139)
at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:24)
at clojure.core.protocols$fn__8262.invokeStatic(protocols.clj:74)
at clojure.core.protocols$fn__8262.invoke(protocols.clj:74)
at clojure.core.protocols$fn__8203$G__8198__8216.invoke(protocols.clj:13)
at clojure.core$reduce.invokeStatic(core.clj:6965)
at clojure.core$reduce.invoke(core.clj:6947)
at clojure_lsp.internal_api$diagnostics_STAR_.invokeStatic(internal_api.clj:346)
at clojure_lsp.internal_api$diagnostics_STAR_.invoke(internal_api.clj:336)
at clojure_lsp.internal_api$diagnostics.invokeStatic(internal_api.clj:484)
at clojure_lsp.internal_api$diagnostics.invoke(internal_api.clj:483)
at clojure_lsp.main$handle_action_BANG_.invokeStatic(main.clj:159)
at clojure_lsp.main$handle_action_BANG_.invoke(main.clj:150)
at clojure_lsp.main$run_BANG_.invokeStatic(main.clj:180)
at clojure_lsp.main$run_BANG_.doInvoke(main.clj:173)
at clojure.lang.RestFn.applyTo(RestFn.java:140)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$apply.invoke(core.clj:662)
at clojure_lsp.main$main.invokeStatic(main.clj:183)
at clojure_lsp.main$main.doInvoke(main.clj:182)
at clojure.lang.RestFn.applyTo(RestFn.java:140)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$apply.invoke(core.clj:662)
at clojure_lsp.main$_main.invokeStatic(main.clj:208)
at clojure_lsp.main$_main.doInvoke(main.clj:206)
at clojure.lang.RestFn.applyTo(RestFn.java:140)
at clojure_lsp.main.main(Unknown Source)
at java.base@21.0.5/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: java.lang.IllegalArgumentException: No matching clause: :on
at clojure_lsp.feature.diagnostics$kondo_finding__GT_diagnostic.invokeStatic(diagnostics.clj:115)
at clojure_lsp.feature.diagnostics$kondo_finding__GT_diagnostic.invoke(diagnostics.clj:92)
at clojure_lsp.feature.diagnostics$kondo_findings__GT_diagnostics$fn__17899.invoke(diagnostics.clj:146)
at clojure.core$mapv$fn__8565.invoke(core.clj:7059)
at clojure.lang.ArrayChunk.reduce(ArrayChunk.java:65)
at clojure.core.protocols$fn__8270.invokeStatic(protocols.clj:135)
at clojure.core.protocols$fn__8270.invoke(protocols.clj:123)
at clojure.core.protocols$fn__8229$G__8224__8238.invoke(protocols.clj:19)
at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:31)
at clojure.core.protocols$fn__8262.invokeStatic(protocols.clj:74)
at clojure.core.protocols$fn__8262.invoke(protocols.clj:74)
at clojure.core.protocols$fn__8203$G__8198__8216.invoke(protocols.clj:13)
at clojure.core$reduce.invokeStatic(core.clj:6965)
at clojure.core$mapv.invokeStatic(core.clj:7050)
at clojure.core$mapv.invoke(core.clj:7050)
at clojure_lsp.feature.diagnostics$kondo_findings__GT_diagnostics.invokeStatic(diagnostics.clj:146)
at clojure_lsp.feature.diagnostics$kondo_findings__GT_diagnostics.invoke(diagnostics.clj:137)
at clojure_lsp.feature.diagnostics$find_diagnostics.invokeStatic(diagnostics.clj:184)
at clojure_lsp.feature.diagnostics$find_diagnostics.invoke(diagnostics.clj:177)
at clojure_lsp.internal_api$diagnostics_STAR_$fn__37752.invoke(internal_api.clj:344)
at clojure.core$pmap$fn__8582$fn__8583.invoke(core.clj:7169)
at clojure.core$binding_conveyor_fn$fn__5842.invoke(core.clj:2047)
at clojure.lang.AFn.call(AFn.java:18)
at java.base@21.0.5/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base@21.0.5/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base@21.0.5/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base@21.0.5/java.lang.Thread.runWith(Thread.java:1596)
at java.base@21.0.5/java.lang.Thread.run(Thread.java:1583)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:896)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:872)
This can be repoduced via the following:
mkdir -p lsp/src/missing
cat <<EOF >lsp/src/missing/diagnostics.clj
(ns missing.diagnostics
(:require
;; unused-namespace
[clojure.set :as set]))
(def obj
(Object.))
(defn ok []
(prn "hi"))
(defn ok2 []
(throw (Exception. "dot")))
(defn ok3 []
(str obj))
;; uncomment any of the following to break clojure-lsp
(defn broken []
(.toString obj))
;; (defn broken2 []
;; (.-something obj))
;; ClojureDart no-dot-required constructor
;;
;; (throw (Exception "no dot"))
EOF
cd lsp
clojure-lsp diagnostics --filenames src/missing/diagnostics.clj
looks like a bug in clojure-lsp indeed
let me try that repro soon
Any news on this?
@evan.green I think I lost that, sorry. I can't repro that on latest clojure-lsp:
I just tested it myself on the latest stable version. Did you un-comment one of the problematic defs before running?
Hum, yes
(ns missing.diagnostics
(:require
;; unused-namespace
[clojure.set :as set]))
(def obj
(Object.))
(defn ok []
(prn "hi"))
(defn ok2 []
(throw (Exception. "dot")))
(defn ok3 []
(str obj))
;; uncomment any of the following to break clojure-lsp
(defn broken []
(.toString obj))
(defn broken2 []
(.-something obj))
;; ClojureDart no-dot-required constructor
;; \#new-and--can-be-omitted
(throw (Exception "no dot")) Ok. It looks like the issue is with Neovim then, as the diagnostics don't show there, but do on the command line.
weird too, I can't see why neovim would not show them if using lsp properly
Disabling clj-kondo in clojure-lsp and running it directly as a plugin make them show up again.
not sure I got what you did, you disabled clj-kondo in clojure-lsp via config?
Yes, and then as a work-around add it back via https://github.com/nvimtools/none-ls.nvim.
yeah, I don't know what else to check on clojure-lsp side, everything looks correct
Ok. Thanks for looking into it... Do you think it's worth asking about in #clj-kondo?
not sure, since clojure-lsp uses kondo and it's working, it's probably working in clj-kondo raw as well, it's something else I'd say, like a older version or so