Fork me on GitHub
#lsp
<
2023-12-11
>
Stefan10:12:22

Hi, since a couple of days (don't know exactly) there seems to be something wrong with the symbol index: in Calva I don't see all references and "go to symbol" also doesn't always work. Is this a known issue? Am I doing somthing wrong? I didn't consciously change anything...

ericdallo11:12:36

No, could you elaborate your problem or show a repro?

Stefan11:12:41

It seems to happen in multiple repos and both on Linux and macOS at least for me and my colleagues. I don't have anything public but I asked my colleagues, I'll update if they have something. What happens is that VSCode says "0 references" when in fact there are references. And such a function also doesn't show up when using the command "go to symbol in workspace". I don't see anything strange in the clojure-lsp log file and I already tried clearing .lsp/.cache.

Stefan11:12:13

There is actually one "real" error in the lsp log:

Stefan11:12:27

2023-12-11T10:13:00.664Z  ERROR [clojure-lsp.server:55] - Error receiving message: Internal error (-32603)
{:method "workspace/didChangeConfiguration"}
com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine  PosixPlatformThreads.java:  211
            com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine       PlatformThreads.java:  833
                                                     java.lang.Thread.run                Thread.java: 1583
                                                 java.lang.Thread.runWith                Thread.java: 1596
                       java.util.concurrent.ThreadPoolExecutor$Worker.run    ThreadPoolExecutor.java:  642
                        java.util.concurrent.ThreadPoolExecutor.runWorker    ThreadPoolExecutor.java: 1144
                                                                      ...                                 
                                        clojure.core.async/thread-call/fn                  async.clj:  486
                                            lsp4clj.server/thread-loop/fn                 server.clj:  122
                                             lsp4clj.server.ChanServer/fn                 server.clj:  261
                           lsp4clj.server.ChanServer/receive-notification                 server.clj:  403
                                                                      ...                                 
clojure.lang.ArityException: Wrong number of args (3) passed to: clojure-lsp.server/fn--36308

Stefan11:12:29

I don't see a pattern to what it can and cannot find. It's not that entire namespaces are missing, it just a symbol here and there. Actually not sure, need to verify

ericdallo11:12:48

that exception is a bug but not related with your problem and should cause no harm

ericdallo11:12:10

is this happening for other repos? can you try to create a repro so I can test?

Stefan11:12:31

Hmm it seems that everything that is public and not used in the namespace itself is not found. I have to fix some other urgent things first @UKFSJSM38, so I can't spend the time to try and reproduce just now. I'll try to do it later. Sorry for not being able to provide more info at the moment (other than that this is a quite large monorepo that is polylith-based).

ericdallo11:12:01

no problem, sounds like it's a classpath issue, and being a monorepo increases the chance we have to configure that, although clojure-lsp has built-in support for polylith based projects. One good way to debug that is via Calva: clojure-lsp server info and check the :source-paths and :classpath if it's correct

👍 1
Stefan19:12:20

Hmm :source-paths contains only a fraction of the actual source folders. Not sure what's going on yet.

ericdallo19:12:50

yeah, that' s the problem so, clojure-lsp to calculate the source-paths just delegates to lein , clj, shadow-cljs etc, so a way is to know what command clojure-lsp is running first so you can run and understand why it's missing source-paths

ericdallo20:12:17

check the https://clojure-lsp.io/troubleshooting/#server-log to find that command, first delete the cache .lsp/.cache to make sure clojure-lsp will run the command

Stefan20:12:57

Ah I think I found it. Joyride recently told me to create a .lsp/config.edn containing {:source-aliases #{:joyride}}. I did exactly that, not quite understanding why. Now I understand that I should add my own aliases (e.g. :dev) there as well, that seems to solve the issue. Not sure why it became a problem only a few days ago, but I think this solves it.

Stefan20:12:55

Should I also add :test to that list?

ericdallo20:12:52

the default value of :source-aliases is :test and :dev

ericdallo20:12:01

you should probably add both + joyride

ericdallo20:12:29

c/c @U0ETXRFEW ☝️ good point to mention when suggesting to add joyride, maybe we should suggest :test :dev :joyride

Stefan20:12:11

That explains it, thanks @UKFSJSM38!!

👍 1
pez06:12:15

Good find, @UGNFXV1FA! I’ll update that suggestion.