This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-27
Channels
- # announcements (13)
- # babashka (59)
- # beginners (58)
- # bitcoin (3)
- # calva (7)
- # cider (2)
- # cljsrn (4)
- # clojure (41)
- # clojure-dev (18)
- # clojure-germany (1)
- # clojurescript (14)
- # conjure (7)
- # cursive (5)
- # datahike (1)
- # graalvm (44)
- # jobs-discuss (3)
- # kaocha (19)
- # lsp (109)
- # luminus (3)
- # off-topic (8)
- # pathom (32)
- # re-frame (4)
- # reveal (3)
- # shadow-cljs (16)
- # spacemacs (5)
- # sql (18)
- # vim (13)
@ericdallo Not sure if this is a good idea, but would it be possible to activate showing the docstring / arg position when pressing TAB when writing a function call like (foo [TAB])
clojure-lsp seems to be having a problem with code like this:
(def foo
{:foo :bar
#?@(:clj
[:baz :quux])})
yes, so it's a clojure-lsp issue indeed to get the code actions for that piece of code
@UE21H2HHD Am I missing anything? 😅
Hum, probably related with the fact that clojure-lsp use clj-commons/rewrite-clj
and not https://github.com/lread/rewrite-cljc-playground
probably we may need to wait @UE21H2HHD work on merging rewrite-cljc with rewrite-clj?
Just to make sure I understand, you were just expecting that the above be parseable, right?
@U0DTSCAUU feel free to open a clojure-lsp issue so we can close it after using rewrite-clj v1
@U0DTSCAUU lastest clojure-lsp release should not fix the parsing issue but should avoid the exception during the code actions retrieval 🙂
Cool I'll give it a try. Moving house this weekend though so I might not get to it for a bit.
@ericdallo 2021.03.01-19.18.54
no longer shows the exception in the log but auto-completion still does not work when there’s a splicing reader conditional in the file
I see, yeah, that probably would only be possible to fix with rewrite-cljc, we will need to wait for the v1 branch
The log shows an exception: java.lang.IllegalArgumentException: No value supplied for key: (read-string "#?@(:clj\n [:baz :quux])")
My clojure lsp server is not starting.. This is the message I get
Server clojure-lsp:5242 status:starting exited with status exit. Do you want to restart it? (y or n) y
check https://clojure-lsp.github.io/clojure-lsp/troubleshooting/#server-is-not-initializing
probably it's in another path so, you can specify the log path in clojure-lsp settings
Interesting, on reading through the troubleshooting page. It says runing clojure-lsp executable should print the following
{}
Apr 12, 2019 7:07:02 AM org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError
SEVERE: Missing header Content-Length in input "{}
"
java.lang.IllegalStateException: Missing header Content-Length in input "{}""""
Mine prints nothing, just hangssorry, my bad.. read the doc wrong… my executable seems to work
./clojure-lsp
{}
Feb 27, 2021 8:54:36 AM org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError
SEVERE: Missing header Content-Length in input "{}
"
java.lang.IllegalStateException: Missing header Content-Length in input "{}
"
check here: https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/
you need to configure lsp-clojure-custom-server-command
I think for some macos the log file is persisted in some weird folder /var/... https://clojurians.slack.com/archives/CPABC1H61/p1613922700052500?thread_ts=1613921955.048800&cid=CPABC1H61
hmm that might be the http://java.io.tmpdir ? which is usually some random path under /var …
this is the log
Starting server...
DEBUG [clojure-lsp.nrepl:24] - nrepl not found, skipping nrepl server start...
Found the problem. I had to set
lsp-clojure-server-command ‘(“bash” “-c” “/Users/rratti/bin/clojure-lsp”)
instead of lsp-clojure-custom-server-command '("bash" "-c" "/Users/rratti/bin/clojure-lsp")
the manual mentions
(setq lsp-clojure-custom-server-command '("bash" "-c" "/path/to/clojure-lsp"))
@U0AHTPQBG both variable should work, lsp-clojure-server-command is deprecated in favor of lsp-clojure-custom-server-command
Wanted: Some elisp or emacs config which allows me to bind a function to M-. which uses cider (without prompting for a symbol) and when it doesn't find the var, falls back to lsp-find-definition (or vice versa, whatever gets me to the function)
Maybe something like this:
(defun find-definition ()
"Try to find definition of cursor via LSP otherwise fallback to cider."
(interactive)
(let ((cursor (point)))
(lsp-find-definition)
(when (eq cursor (point))
(cider-find-var))))
Almost, I think. It redirects me to the right definition, but is still going to invoke the cider one too
(defun find-definition ()
"Try to find definition of cursor via LSP otherwise fallback to cider."
(interactive)
(let ((cursor (point)))
(lsp-find-definition)
(when (eq cursor (point))
(cider-find-var))))
(define-key clojure-mode-map (kbd "M-.") #'find-definition)
(define-key clojurec-mode-map (kbd "M-.") #'find-definition)
(define-key clojurescript-mode-map (kbd "M-.") #'find-definition)
This will not work if the definition is in another buffer. Updated:
(defun find-definition ()
"Try to find definition of cursor via LSP otherwise fallback to cider."
(interactive)
(let ((cursor (point))
(buffer (current-buffer)))
(lsp-find-definition)
(when (and (eq buffer (current-buffer))
(eq cursor (point)))
(cider-find-var))))
This is great -- I needed this too, but I had to add
(define-key cider-mode-map (kbd "M-.") #'find-definition)
Possibly because I had set up
(clojure-mode . cider-mode)
in cider?(defun find-definition ()
"Try to find definition of cursor via LSP otherwise fallback to cider."
(interactive)
(let ((cursor (point)))
(lsp-find-definition)
(when (eq cursor (point))
(cider-find-var))))
(define-key clojure-mode-map (kbd "M-.") #'find-definition)
(define-key clojurec-mode-map (kbd "M-.") #'find-definition)
(define-key clojurescript-mode-map (kbd "M-.") #'find-definition)