Open p-himik opened 3 years ago
That unused public symbol feature comes from clojure-lsp. Let's see what @ericdallo has to say about this.
At this point, proj.a/f will be marked as unused, despite it being used in proj.b
It seems like at this point the references haven't been updated (at least on the client, from the server). Maybe something needs to happen on file change that isn't currently to update those references.
Maybe something needs to happen on file change that isn't currently to update those references.
It seems to be the case, yes. When I change b.clj
, only its metadata is requested from clojure-lsp, at least as far as I can tell from the logs. So no rechecking of a.clj
is done.
This is a known issue on clojure-lsp indeed as ATM we only update the diagnostics for the file when we run clj-kondo on that file, which is done for all project files when server starts and when user change that file.
There is a flag to fix that issue :notify-references-on-change
that is disabled by default for performance issues, it updates the references of the changed function/var.
I want to make that as the default behavior but we will need to think how to improve that
I made some huge improvements on the :notify-references-on-file-change
feature, it's still disabled by default but probably soon it'll be the default if no performance issue is found.
if you want to try with calva, you just need to have something like this in your .lsp/config.edn
:
{:notify-references-on-file-change true}
@ericdallo Did you mean .lsp/config.edn
?
Yes, thanks haha
It's only run when the file containing the symbol definition changes. To reproduce, create two files:
At this point,
proj.a/f
will be marked as unused, despite it being used inproj.b
. Changingproj.b
in any way won't re-run the check. Changingproj.a
in any way will run it andproj.a/f
will stop being highlighted as unused. You can do the reverse as well - after doing the above, remove(proj.a/f)
fromproj.b
and notice howproj.a/f
is still not highlighted. Changeproj.a
in any way, and the function will become highlighted as unused.