This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-18
Channels
- # announcements (10)
- # babashka (21)
- # beginners (99)
- # biff (66)
- # catalyst (3)
- # cherry (1)
- # cider (11)
- # clojure (38)
- # clojure-austin (3)
- # clojure-dev (23)
- # clojure-europe (21)
- # clojure-hungary (10)
- # clojure-nl (2)
- # clojure-norway (57)
- # clojure-uk (2)
- # clojurescript (9)
- # cursive (6)
- # fulcro (5)
- # hyperfiddle (14)
- # integrant (4)
- # introduce-yourself (3)
- # lsp (24)
- # off-topic (14)
- # reagent (12)
- # reitit (13)
- # releases (8)
- # sci (16)
- # shadow-cljs (8)
- # solo-full-stack (1)
- # spacemacs (5)
- # squint (3)
- # xtdb (14)
No definitions found for: LSP identifier at point
I'm seeing this error all the time in our monorepo (containing 100 projects). This is probably due to configuration errors on my part, but I've been reluctant to look into them for some reason.
So this week I've decided to investigate every "jump-to-definition" error I encounter and document my findings in this thread, stream-of-conscious styleexample1: symbol used in a clojure file, required from a support library in the monorepo
My first guess is that the classpath is wrong. Looking at the docs, this seems like a promising lead, given that the lib is included only when -A:dev
is specified
So following the docs, I'm adding a config setting
{"project-specs" [{:project-path "deps.edn"
:classpath-cmd ["clojure" "-A:dev" "-Spath"]}]}
That doesn't seem to be workingDo I need to clear some caches? Restart emacs? eglot-reconnect
?
with eglot: if they point to jars you need to use jarchive to allow eglot to get to their source -> https://github.com/mpenet/emax/blob/master/init.el#L461-L466
:local/root
I'm using jarchive already - but yeah that's a good pointer for future reference!
OK 💡 this seems to be working
{:source-aliases #{:dev}}
Ok trying it again I can confirm that
:project-specs [{:project-path "deps.edn" :classpath-cmd ["clj" "-Spath"]}]
doesn't work but
:source-aliases #{:dev}
Also it seems like restarting emacs is enough to make sure the new config file is taken into account (this is important when making systematic improvements). Is there a more lightweight way to be 100% sure I'm not seeing cached results?
example 1 is solved ✅ – I'll add to this thread when I run into new issues
also .clj-kondo
?
this is a handy shortcut
% git clean -fxd .clj-kondo .lsp
Removing .clj-kondo/.cache/
Removing .clj-kondo/babashka/
Removing .clj-kondo/com.pitch/
Removing .clj-kondo/funcool/
Removing .lsp/.cache/
@U06F82LES by default clojure-lsp will use -A:dev:test
unless you override project-specs or source-aliases, so that should work out of the box
ah, it's correct, it's done https://github.com/clojure-lsp/clojure-lsp/blob/1984199f516840813af618f5f0f23492707963b4/lib/src/clojure_lsp/startup.clj#L200
ah interesting @UKFSJSM38!