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.
Hello! That emacs.d cache folder should not be related, probably the classpath scan is not being ran properly
Remove the .lsp/sqlite.db and .clj-kondo/.cache and then restart the server on the second project with lsp-workspace-restart
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
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:(
Yeah, could you try to run lsp-clojure-cursor-info
on the keyword that is the definition of the event/sub ?
Also, make sure you are on latest clojure-lsp, with clojure-lsp --version
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}
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}}
The versions are both
clojure-lsp 2021.05.27-17.42.34
clj-kondo 2021.04.24-SNAPSHOT
Yeah, for some reason it's not indexing the definition, Do you have a .clj-kondo on the project?
Also, is there any .lsp-config.edn that is different on the machines? Like one on home dir
Yes, it contains config.edn created by Michiel Borkent. I happen to work with him:)
But I use Cursive, trying to switch to Emacs.
The .clj-kondo dir is int the app/ subproject, which I also set as a root for LSP.
Haha, alright, so first let check if both machines have same .lsp/config.edn, not only on the project but on your home dir
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
Ok, I did that, the root is the same on both machines but still the same behaviour:( No ~/.lsp
The not-working machine is older and full of cruft, I sense the problem there. The working one is brand new.
Hum, not sure that would affect that behaviour
Something that may help a lot is trying to create a minimal repro, some repo with basic cljs/reframe
And test on both machines
Also this helps as I can test in my side as well
Will do! Thanks. If I find something reportable, I'll get beck to you.