This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-26
Channels
- # adventofcode (2)
- # announcements (7)
- # babashka (20)
- # beginners (77)
- # brompton (6)
- # calva (4)
- # clj-kondo (28)
- # cljdoc (2)
- # cljfx (10)
- # cljsrn (1)
- # cljtogether (1)
- # clojure (77)
- # clojure-europe (33)
- # clojure-gamedev (12)
- # clojure-uk (11)
- # clojurescript (95)
- # clojureverse-ops (4)
- # core-async (4)
- # core-logic (1)
- # cryogen (2)
- # cursive (14)
- # data-science (3)
- # datomic (47)
- # duct (1)
- # emacs (7)
- # fulcro (51)
- # gratitude (8)
- # helix (14)
- # hoplon (4)
- # improve-getting-started (60)
- # jobs (1)
- # jobs-discuss (4)
- # joker (11)
- # lsp (99)
- # meander (62)
- # membrane (5)
- # news-and-articles (3)
- # off-topic (64)
- # pathom (3)
- # polylith (11)
- # practicalli (7)
- # react (1)
- # reagent (8)
- # reveal (15)
- # shadow-cljs (78)
- # specter (7)
- # sql (16)
- # tools-build (1)
- # tools-deps (29)
- # workspaces (1)
- # xtdb (17)
Hello! I see in the logs > ERROR Could not load project cache from '/path/2/fulcro-rad-demo/.lsp/sqlite.db But this is a new project and I have not used LSP there before. So perhaps it should be just info/warning, not error?
I also get
> INFO [clojure-lsp.crawler:21] - Finding classpath via clojure -Spath
> ERROR [clojure-lsp.crawler:40] - Error while looking up classpath info in .../fulcro-rad-demo Cannot run program "clojure" (in directory ".../fulcro-rad-demo"): error=2, No such file or directory
Yet, in the shell, it is just fine:
❯ which clojure
/usr/local/bin/clojure
Does LSP have a different path? How to verify/fix that?and shadow
(I run LSP via Cursive and its LSP Support plugin)
Everything worked as expected with emacs, I suspect you LSP plugin sent a wrong project root ../fulcro-rad-demo
instead of /absolute/path/to/fulcro-rad-demo
(I added a log on clojure-lsp server to log the project-root to easily find issues like that)
cool, thanks! how can I get the version with the log added?
only on next release or building manually on master, but there are other ways to get that
As mentioned https://clojure-lsp.github.io/clojure-lsp/troubleshooting/#client-server-log, every client should provide the client<->server log
I have clojure-lsp log file, if that is what you mean
I just tried again after restarting LSP and get the same error, this time with abs. paths
> Error while looking up classpath info in /Users/me/Projects/external/fulcro-all/fulcro-rad-demo Cannot run program "clojure" (in directory "/Users/me/Projects/external/fulcro-all/fulcro-rad-demo"): error=2, No such file or directory
(+ the same error for npx
)
quite possible, since clojure is under /usr/local/... and npx is in /Users/me/.nvm/versions/node/v10.24.1/bin/npx
yeah, probably the shell that LSP plugin is using to launch clojure-lsp doesn't have there commands on PATH
Here is explanation for npx and a workaround https://github.com/gtache/intellij-lsp/issues/157
Perhaps print $PATH when you cannot find the executable?
I think we already log this to both clojure-lsp server log and client so checking the exception seems good enough, is just that the java exception is not clear enough for shell commands
Does LSP handle ClojureScript’s “Clojure Namespace Aliasing” for things like Goto Definition and Show Doc String? https://clojurescript.org/guides/ns-forms#_clojure_namespace_aliasing
Not sure if it is directly that, or related to the reader macro for language conditionals, as macros in a .cljc
file guarded with a #?(:clj
also don’t show anything when trying to Goto Definition or Show Doc String
If I understood correctly, you are asking if clojure-lsp will go to cljs.test
even if you required clojure.test
in a cljs project?
Trying to understand which things I can expect to lookup vs not, and I think that is what I am seeing at least
other CLJ based macros in ClojureScript also seem to behave similar, but not sure if that is related or not
This definitely doesn't works with clojure-lsp, unless clj-kondo return the cljs.test analysis in the place of clojure.test
feel free to open an issue for that, but I think we would need to do some improvements on clj-kondo as well, right @U04V15CAJ?
As far as I can understand, reading that docs is that doesn't need to be a cljc file
:thumbsup: Will see about getting something together for a baseline to reproduce, just wanted to make sure I was on the right track and understanding what I am thinking is happening. 😉
Not sure if you want a full basic project setup, or just the file, but if the file, I pasted it above
the async go
and <!
references don’t show up with the help, regardless of which reference is used…
if there are any logs or any other things that might be helpful, I can push them up there too
How does clojure-lsp communicate with an editor? Do they use stdin+stdout, or...?
the LSP client (editor) is responsible for spawning the LSP server process, not as a daemon, but as a process, and they communicate via stdin/out
ok, thx! Now I understand I must not mess with the stdin/out 🙂
haha yes, you can easily try clojure-lsp from your terminal to understand that if you want
My log file contains only
[clojure-lsp.server:419] - Starting server...
[clojure-lsp.nrepl:20] - ====== LSP nrepl server started on port 65034
[clojure-lsp.server:304] - Initializing...
It has run for 4 minutes now. Is it possible it got stuck somehow? I execute it from an editor via this script
#!/bin/bash -l
eval "$(direnv hook bash)" > /dev/null
exec /usr/local/bin/clojure-lsp #--verbose
after that Initializing..
log, clojure-lsp checks for the :log-path
config and change log to log to that path
OMG, you are right, and I completely forgot
Ok, I removed the setting and now the log file also has
[clojure-lsp.source-paths:135] - Automatically resolved source-paths from project.clj: #{"src" "src/main/clojure" "dev" "test" "src/test/clojure"}
but according to ps
, lsp is not running anymoreI tried again and I see a number of clojure-lsp runs, one by one. From the log:
T17:01:15.970Z [clojure-lsp.server:419] - Starting server...
T17:01:15.990Z [clojure-lsp.nrepl:20] - ====== LSP nrepl server started on port 65034
T17:01:15.997Z [clojure-lsp.server:304] - Initializing...
T17:01:16.021Z [clojure-lsp.source-paths:135] - Automatically resolved source-paths from project.clj: #{"src" "src/main/clojure" "dev" "test" "src/test/clojure"}
T17:01:10.953Z [clojure-lsp.server:419] - Starting server...
T17:01:10.975Z [clojure-lsp.nrepl:20] - ====== LSP nrepl server started on port 65034
T17:01:10.983Z [clojure-lsp.server:304] - Initializing...
T17:01:11.009Z [clojure-lsp.source-paths:135] - Automatically resolved source-paths from project.clj: #{"src" "src/main/clojure" "dev" "test" "src/test/clojure"}
T17:01:05.938Z [clojure-lsp.server:419] - Starting server...
T17:01:05.961Z [clojure-lsp.nrepl:20] - ====== LSP nrepl server started on port 65034
T17:01:05.968Z [clojure-lsp.server:304] - Initializing...
T17:01:05.997Z [clojure-lsp.source-paths:135] - Automatically resolved source-paths from project.clj: #{"src" "src/main/clojure" "dev" "test" "src/test/clojure"}
T17:00:55.896Z [clojure-lsp.server:419] - Starting server...
T17:00:55.924Z [clojure-lsp.nrepl:20] - ====== LSP nrepl server started on port 65034
T17:00:55.936Z [clojure-lsp.server:304] - Initializing...
it seems the IntelliJ LSP plugin is simply cursed 😿
I already saw people setupping and running correctly, probably is not well documented what it's needed to do
• any bad exceptions goes to the stderr, but depending on the exception, if not critical, goes to server log
the server log has nothing and lsp/log/clojure_err_20210826.log
as well as _out_
are empty
clojure-lsp 2021.08.24-14.41.56 clj-kondo 2021.08.07-SNAPSHOT
Hm, it works on another project. In failing one I see a WARN log from the intellij LSP plugin about invalid url for a maven dependency I have, it is possible despite being just warning that the plugin rashes
You can try on your terminal:
echo "Content-Length: 168
{"jsonrpc":"2.0","method":"initialize","params":{"rootUri":"file:///path/to/your/project/","initializationOptions":{"lint-project-files-after-startup?":false}},"id":1}
" | ./clojure-lsp
remeber to update both project root and Content Lenght of the jsonOk! I have made some progress. I have got my wrapper script to work and use it to set PATH so that lsp finds both clojure and npx. Thus it stopped popping errors in intellij but still IntelliJ times out, perhaps because the analysis takes too long. Last log is > Analyzing 1/4 batch paths with clj-kondo... from 2 minutes ago. Perhaps it just takes a while the first time?
but yeah, the very first time takes longer because it scans whole classpath, next startups should be few seconds
Ok, will try that. The "Analyzing 1/4 batch paths with clj-kondo" flog is the last one and there is no clojure-lsp process running, don't know whether it died itself or the intellij plugin killed it upon timeout
Yep , it seems indeed the plugin kills clojure-lsp if it takes over its timeout
Ok, now it works, after I increased the timeout and restarted intellij (it took about 1min for clojure-lsp to do its job)
Awesome, now it works on the other prj as well. So the key was to increase the timeout sufficiently
thx a lot for your invaluable help!!!
Nice! I really don't know why this plugin has a timeout like that, but we should surely add that to the clojure-lsp client intellij section docs, willing to open a PR later ?
Thank YOU!
Perhaps LSP Support has such a short timeout for Init because it expects it to be short, not to do the whole analysis thing. Perhaps it thinks the analysis is just started and runs async, in the background?