Question on :external? :
I'm looking for the call sites of a function using (q/find-references-from-cursor db uri fn-row fn-col false). This works, but sometimes it returns two references for the one call site - one reference with :external? false and the other with :external? true . Everything else in the two references is the same. Same :row & :col, :uri, etc...
It seems like :external? is set in kondo.clj to indicate that a kondo reference came from outside of the project's sources (eg a jar file). Why would I get back two references for one call with one being external?
I don't recall any case where we should return 2 references, that sounds like a bug 🤔 it's weird they being completely equal
OK, thanks! Wanted to check that I have the right idea before I started looking for a bug
I hope it's a bug, if that means reduce analysis size when fixed which means less memory :)
Right! I'll let you know
I think I see what's going on here. There are two things that I missed • I'm working on clojure-lsp • The two references are to the same function, but they are not exactly identical. One URI was coming from the clojure-lsp jar file and the other from the sources
:uri "file:///home/jr/Projects/clojure-lsp/clojure-lsp:clojure_lsp/refactor/transform.clj",
vs
:uri "file:///home/jr/Projects/clojure-lsp/lib/src/clojure_lsp/refactor/transform.clj",
(hard to notice)
When I restarted clojure-lsp, the external jar file reference disappeared.
I'm not sure how it got there, but I imagine that it will come back, and I'll debug furtherMaybe this will only happen when attached to a running clojure-lsp? I've attached the REPL to the running clojure-lsp which will have the jar clj files, and then I'm reevaluating the same namespaces in the source files. (Although I still can't get it to reproduce on command)
Aha yeah, I thought it could be something like that, it's pretty common to cljs users face same when opening public folder wrongly
What you probably did was go to a definition that sent you to the jar? Even so Clojure-lsp shouldnt have a dep on Clojure-lsp itself so weird
Ah if you did something with the repl which created a temp buffer under, when accessing it lsp-mode/eglot would send a didOpen notification and Clojure-lsp would lint that file, generating analysis, very likely
I don't access jar things via repl tho always via lsp
That sounds plausible. I'm mostly using Calva, and I did notice that it sometimes opens the jar file's sources, even for clojure-lsp files. It's annoying, but I couldn't figure out why. Maybe I accidentally introduced this when working on the performance tests, which do use the jar file? Anyway, I don't think it's a bug, unfortunately for the space issue. I'll try to keep my eyes open for it
Yeah never saw that on emacs or calva, still need to check the performance tests but as you say it makes sense