This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-24
Channels
- # announcements (3)
- # babashka (23)
- # beginners (35)
- # cider (3)
- # clara (3)
- # clj-kondo (14)
- # cljdoc (1)
- # cljs-dev (1)
- # clojure (82)
- # clojure-austin (9)
- # clojure-europe (5)
- # clojurescript (23)
- # conjure (62)
- # cursive (73)
- # defnpodcast (1)
- # emacs (3)
- # ethereum (1)
- # gratitude (1)
- # hyperfiddle (12)
- # introduce-yourself (1)
- # leiningen (2)
- # lsp (44)
- # malli (7)
- # polylith (2)
- # portal (17)
- # re-frame (5)
- # reitit (3)
- # sci (8)
- # shadow-cljs (5)
- # tools-build (11)
Hello all, I'm working on adding lsp to my emacs config and I was not getting completions for libraries. Then I tried in vscode and got the same result. Should the lsp support be helping me with included libraries? If so, is there some kind of config I'm missing in the .lsp/config.edn
?
For example, entering (clojure.string/
provides no suggestions.
Thanks in advance for any help!
Sorry for the confusion, that is what I have been entering as the parens were automatically paired. Thanks
This bit looks interesting
2022-04-24T17:41:20.488Z WARN [clojure-lsp.feature.java-interop:258] - [Java] Skipping download JDK source, setting `:java :download-jdk-source?` is disabled.
2022-04-24T17:41:20.489Z WARN [clojure-lsp.feature.java-interop:272] - [Java] JDK source not found, skipping java analysis.
BTW from the log clojure-lsp is loading, so probably something else, coyld you share the full server logs?
It doesn't work in vscode either?
I had a while where I couldn't get completion to work either, so I deleted every clj-kondo
and clojure-lsp
related cache file, and all my user-level config for both of those, and also updated my version of calva/kondo/lsp around sort of the same time-ish.
I'm not sure which of the above made it eventually work, but now my definitions and completions work better than ever before, and I even get code actions (lightbulb menu in some IDEs) for "require/import this symbol from ... ns"
Here's the log
At the very end of the log file you can see completion requests I made to a library
As far as config, I reverted to an out-of-the-box doom setup and I didn't have a .lsp/config.edn
yet but I did have .clj-kondo/config.edn
with {:lint-as {mount.core/defstate clojure.core/def}}
Yeah, server looks ok, alright, try: ā¢ remove cache file rayat mentioned: .lsp/.cache and restart server and paste logs here, pay attention if no errors when trying to get classpath
BTW from the logs, I think you don't have latest clojure-lsp, I suggest you update just to be sure it's not a fixed bug
I installed via homebrew, is that what you would recommend or should I do something different?
If installed via homebrew tap following https://clojure-lsp.io/installation/ its ok
2022-04-25T00:21:16.841Z ERROR [clojure-lsp.classpath:74] - Error while looking up classpath info in /Users/shayne/Sandbox/clojure/sagas Cannot run program "clojure" (in directory "/Users/shayne/Sandbox/clojure/sagas"): error=2, No such file or directory
I think I know now
Clearing the .cache still seems essential
Yeah, I plan to fix that for next release, it seems a exception on loading classpath still caches empty analysis
Just to be clear, is it emacs trying to run that clojure command or the lsp server?
(clojure.java.shell/sh "echo test")
1. Caused by java.io.IOException
error=2, No such file or directory
Sorry, I'm trying to run clojure using the same sh function that's being used in clojure-lsp
clojure-lsp still can start clojure but this works
(clojure.java.shell/sh "clojure" "-version")
in my replyour repl is different that what clojure-lsp is using, clojure-lsp relies on the PATH that emacs is using
so you need to fix that on emacs side to clojure-lsp be able to find clojure in the shell spawned from emacs
BTW I fixed on clojure-lsp to not cache when classpath scan fails. you can find soon a nightly build on #clojure-lsp-builds meanwhile
When you say fix that on the emacs side, do you mean adding the directory that contains the clojure bin to the exec-path
variable?
yeah, usually doom already takes care of that, maybe try lauching doom-emacs from your terminal? I know this happens for some mac users
So I was setting exec-path but when I start emacs via the terminal the process-environment
variable gets my full path
No idea