lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
jsmesami 2021-05-28T13:09:56.083Z

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.

ericdallo 2021-05-28T14:31:30.083100Z

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

ericdallo 2021-05-28T14:33:20.083300Z

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

ericdallo 2021-05-28T14:34:57.083500Z

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

jsmesami 2021-05-28T16:09:44.083700Z

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:(

ericdallo 2021-05-28T16:11:21.083900Z

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

ericdallo 2021-05-28T16:11:58.084100Z

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

jsmesami 2021-05-28T16:17:25.084300Z

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}

jsmesami 2021-05-28T16:17:49.084500Z

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}}

jsmesami 2021-05-28T16:20:41.085100Z

The versions are both

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

ericdallo 2021-05-28T16:23:19.085300Z

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

ericdallo 2021-05-28T16:23:56.085500Z

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

jsmesami 2021-05-28T16:24:59.085700Z

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

jsmesami 2021-05-28T16:25:20.085900Z

But I use Cursive, trying to switch to Emacs.

jsmesami 2021-05-28T16:26:13.086100Z

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

ericdallo 2021-05-28T16:26:21.086300Z

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

ericdallo 2021-05-28T16:27:31.086500Z

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

jsmesami 2021-05-28T16:33:06.086700Z

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

jsmesami 2021-05-28T16:33:52.086900Z

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

ericdallo 2021-05-28T16:34:23.087100Z

Hum, not sure that would affect that behaviour

ericdallo 2021-05-28T16:35:15.087300Z

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

ericdallo 2021-05-28T16:35:20.087500Z

And test on both machines

ericdallo 2021-05-28T16:35:52.087700Z

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

jsmesami 2021-05-28T16:36:17.087900Z

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

👍 1