Fork me on GitHub
#lsp
<
2021-05-28
>
jsmesami13:05:56

Hello, inexperienced Emacs and LSP user here. When working on a ClojureScript project, I'm able to do lsp-find-definition on a namespaced keyword (re-frame event or subscription) on one machine, but not on the other. They are the exact same setup, the only difference is I have emacd.d/workspace/.cache on the former machine and not on the latter. I don't really know how it got there, but it seems to make things work:) What can I do to have the same fuctionality on both machines? 🙏 Both machines are Fedora Workstation, Emacs 27.2, latest LSP.

ericdallo14:05:30

Hello! That emacs.d cache folder should not be related, probably the classpath scan is not being ran properly

ericdallo14:05:20

Remove the .lsp/sqlite.db and .clj-kondo/.cache and then restart the server on the second project with lsp-workspace-restart

ericdallo14:05:57

This should make clojure-lsp re analyze the classpath, make sure everything worked checking the clojure-lsp log, you can get it via log-path from lsp-clojure-server-info

jsmesami16:05:44

Hi Eric, thank you for your work on LSP and the advise, but it didn't work. You are right, the workspace/.cache dir has no effect. The clojure-lsp log file shows no errors, only some DEBUG messages from lsp.crawler: Invalid clj-kondo analysis. Cannot find position data for ... but it shouldn't be the problem because they also show on the working machine. lsp-doctor is all green on both machines, so I'm running out of ideas:(

ericdallo16:05:21

Yeah, could you try to run lsp-clojure-cursor-info on the keyword that is the definition of the event/sub ?

ericdallo16:05:58

Also, make sure you are on latest clojure-lsp, with clojure-lsp --version

jsmesami16:05:25

It's

LSP :: {:element
 {:end-row 39,
  :name-end-col 53,
  :name-end-row 39,
  :name-row 39,
  :ns dre.help.subs,
  :name "help-content",
  :auto-resolved true,
  :filename
  "/home/ondra/Development/client/dre/DocSearch/app/src-cljs/dre/help/views.cljs",
  :alias subs,
  :col 34,
  :name-col 34,
  :end-col 53,
  :bucket :keywords,
  :row 39},
 :definition nil}

jsmesami16:05:49

And on the healthy machine:

LSP :: {:element
 {:end-row 39,
  :name-end-col 53,
  :name-end-row 39,
  :name-row 39,
  :ns dre.help.subs,
  :name "help-content",
  :auto-resolved true,
  :filename
  "/home/ondra/Development/client/dre/DocSearch/app/src-cljs/dre/help/views.cljs",
  :alias subs,
  :col 34,
  :name-col 34,
  :end-col 53,
  :bucket :keywords,
  :row 39},
 :definition
 {:end-row 27,
  :name-end-col 16,
  :name-end-row 27,
  :name-row 27,
  :ns dre.help.subs,
  :name "help-content",
  :auto-resolved true,
  :filename
  "/home/ondra/Development/client/dre/DocSearch/app/src-cljs/dre/help/subs.cljs",
  :col 2,
  :name-col 2,
  :reg re-frame.core/reg-sub,
  :end-col 16,
  :bucket :keywords,
  :row 27}}

jsmesami16:05:41

The versions are both

clojure-lsp 2021.05.27-17.42.34
clj-kondo 2021.04.24-SNAPSHOT

ericdallo16:05:19

Yeah, for some reason it's not indexing the definition, Do you have a .clj-kondo on the project?

ericdallo16:05:56

Also, is there any .lsp-config.edn that is different on the machines? Like one on home dir

jsmesami16:05:59

Yes, it contains config.edn created by Michiel Borkent. I happen to work with him:)

jsmesami16:05:20

But I use Cursive, trying to switch to Emacs.

jsmesami16:05:13

The .clj-kondo dir is int the app/ subproject, which I also set as a root for LSP.

ericdallo16:05:21

Haha, alright, so first let check if both machines have same .lsp/config.edn, not only on the project but on your home dir

ericdallo16:05:31

Yeah, also check the root of your project is the same on both machines, I mean, lsp-workspace-folders-remove, select the project and the lsp again to select the correct root

jsmesami16:05:06

Ok, I did that, the root is the same on both machines but still the same behaviour:( No ~/.lsp

jsmesami16:05:52

The not-working machine is older and full of cruft, I sense the problem there. The working one is brand new.

ericdallo16:05:23

Hum, not sure that would affect that behaviour

ericdallo16:05:15

Something that may help a lot is trying to create a minimal repro, some repo with basic cljs/reframe

ericdallo16:05:20

And test on both machines

ericdallo16:05:52

Also this helps as I can test in my side as well

jsmesami16:05:17

Will do! Thanks. If I find something reportable, I'll get beck to you.

👍 3