This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-26
Channels
- # aws-lambda (15)
- # babashka (7)
- # beginners (124)
- # calva (7)
- # cider (19)
- # clj-kondo (26)
- # clojure (261)
- # clojure-australia (3)
- # clojure-dev (10)
- # clojure-europe (45)
- # clojure-nl (4)
- # clojure-uk (6)
- # clojurescript (10)
- # datomic (7)
- # depstar (7)
- # emacs (11)
- # fulcro (41)
- # graalvm (48)
- # helix (1)
- # honeysql (17)
- # inf-clojure (7)
- # introduce-yourself (3)
- # jackdaw (2)
- # lsp (36)
- # malli (2)
- # meander (2)
- # membrane (1)
- # missionary (11)
- # off-topic (17)
- # pathom (83)
- # polylith (15)
- # re-frame (31)
- # reagent (42)
- # sci (35)
- # shadow-cljs (13)
- # spacemacs (13)
- # sql (19)
- # timbre (3)
- # tools-deps (77)
Is there a correct way of restarting the LSP server from emacs? I tried lsp-workspace-restart
and the server starts, but I am unable to do things like renaming a namespace?
I get the error Connected Server does not support naming
When hovering over the little rocket in the powerline, it says clojure-lsp/42334334/starting
Perhaps its not fully starting because of my dodgy code 🙂
The server seems to stop at some point after as I've had to restart a couple of times.
Any suggestions ?
Have you peeked the logs under /tmp/clojure-lsp*?
☝️ exactly, the way to restart is correct, but the server is not starting because some issue, check the server log https://clojure-lsp.github.io/clojure-lsp/troubleshooting/#getting-server-log
The logs are not brimming with information
2021-07-26T11:31:25.985Z statsbomb INFO [clojure-lsp.main:391] - Starting server...
2021-07-26T11:31:25.989Z statsbomb INFO [clojure-lsp.nrepl:21] - ====== LSP nrepl server started on port 41953
2021-07-26T11:54:40.868Z statsbomb INFO [clojure-lsp.main:345] - Shutting down
Yeah, no exceptions or error logs, could you check the clojure-lsp stderr emacs buffer?
Ah, there is some nastyness in that buffer...
Jul 24, 2021 11:53:39 AM org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError
SEVERE: Unable to invoke no-args constructor for class org.eclipse.lsp4j.CodeLensWorkspaceCapabilities. Registering an InstanceCreator with Gson for this type may fix this problem.
java.lang.RuntimeException: Unable to invoke no-args constructor for class org.eclipse.lsp4j.CodeLensWorkspaceCapabilities. Registering an InstanceCreator with Gson for this type may fix this problem.
This is the start of a long stacktrace 🙂the problem though, is that we already have that reflection config, are you using latest clojure-lsp?
We fixed that last month: https://github.com/clojure-lsp/clojure-lsp/commit/da83ea614da850ca79145032e1cb3dbd61c3d57f
Doh, I've move to a new computer and it doesnt look like clojure-lsp binary is installed on the execution path.
you can force lsp-mode reinstalling latest clojure-lsp with C-u
M-x
lsp-install-server
clojure-lsp
downloaded and workspace initialised successfully... thank you.
Now its telling me how many bugs I have in my code :rolling_on_the_floor_laughing:
but thats not your problem
Very useful troubleshooting though, thank you.
If you find anything that should be here: https://clojure-lsp.github.io/clojure-lsp/troubleshooting/ LMK
I found an interesting Emacs edge case for lsp when adding a new file and automatically inserting the namespace 1. Existing project open (probably the same on a new project) 2. Use helm find-file to create a new file in a directory that does not yet exist 3. The buffer is created and a mini-buffer prompt asks if the directory should be created 3.1 At this time LSP (the UI I guess) is trying to add the ns expression to the buffer, however, the buffer is somehow switched to read-only mode 4. In the mini-buffer, confirm the creation of the new directory for the file 5. change the new clojure buffer to be writable and continue hacking. This has only happened once so far and not really a big issue. I can raise an issue somewhere if you think there is merrit?
I can't not repro that, it works perfect to me, your issue seems your buffer being marked as read only, not sure why
anyway, it seems to be a lsp-mode (not UI) issue/question, I suggest you ask on their Discord channel, they may help you understand why this is happening for you
Thanks for the insight about possible areas to look into. I'll investigate further if it happens again. Thanks.
Another curiosity, when using a namespace with a zero at the end of the name, e.g. practicalli.auth0
Creating a file for this namespace, lsp does insert a namespace form, but seems to not be able to parse the actual namespace correctly. Instead it inserts (ns Wrong type argument: stringp, nil)
I think I've seen this when adding a dev/user.clj file and wonder if its lsp or an underlying Java classpath issue.
yasnippets also seems to struggle with auth0 namespace when using the ns snippet.
Probably quite an edge case anyway.
An edge case indeed, but we can debug it to check where the bug is, client or server side
you can check lsp mode client<->server json logs to confirm server returned a correct code after the didOpen request
Is that the same logs as /tmp/clojure.xxxxxxxxxxx
No, check lsp-log-io section: https://emacs-lsp.github.io/lsp-mode/page/troubleshooting/