This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-07
Channels
- # aleph (4)
- # announcements (9)
- # babashka (44)
- # beginners (6)
- # cider (8)
- # clj-kondo (5)
- # clojars (10)
- # clojure (10)
- # clojure-berlin (1)
- # clojure-dev (9)
- # clojure-europe (20)
- # clojure-gamedev (1)
- # clojure-miami (2)
- # clojure-nl (1)
- # clojure-norway (21)
- # clojure-uk (5)
- # clojurescript (12)
- # conjure (1)
- # cursive (19)
- # data-science (2)
- # datahike (10)
- # etaoin (5)
- # events (3)
- # fulcro (14)
- # gratitude (2)
- # honeysql (8)
- # humbleui (1)
- # hyperfiddle (60)
- # introduce-yourself (7)
- # jobs-discuss (27)
- # juxt (2)
- # kaocha (7)
- # lsp (23)
- # malli (9)
- # missionary (2)
- # off-topic (48)
- # pathom (24)
- # releases (1)
- # shadow-cljs (256)
- # sql (46)
- # xtdb (19)
I'm having trouble let lsp to display overloaded function docs with all possible arities like cider does in emacs echo area with eglot
apart from:
(eldoc-echo-area-use-multiline-p nil)
.config/clojure-lsp/config.edn
{:hover {:arity-on-same-line? true}}
Are there any other settings I need to tweak?
(defn xx
([a] 1)
([a b] 1))
cider would show xx: ([a] [a b]) in echo area but clojure-lsp would only show (xx [a])
cross ref: https://clojurians.slack.com/archives/CPABC1H61/p1678733411503889as far as I understand, if I open the full *eldoc*
*,* i can see
(xx [a])
(xx [a b])
my/ns [a] [a b]
and echo area only show the first line?
ideally I would like it to show the last line one as cider does if possibleDid you try the setting :hover`
:arity-on-same-line?
`?
https://clojure-lsp.io/settings/#all-settings
yeah, that's what I put {:hover {:arity-on-same-line? true}}
in ~/.config/clojure-lsp/config.edn
i'm using nixpkgs unstable's 2023.08.06-00.28.06 version. Looks like the setting is not take effect somehow?
does it look normal that I found
2024-02-07T13:54:34.274Z WARN [clojure-lsp.server:401] - {:settings {}}
in the lsp log?
well... I tried to build the latest clojure-lsp from master by nix shell github:clojure-lsp/clojure-lsp
, and it seems to have the same result.. And since the DEV version generated huge amount of log, so I can dig up some thing like
:project-settings {:log-path "/tmp/clojure-lsp.log", :hover {:arity-on-same-line? true}}
from the log, so I assume the setting gotten read correctly at leaset? But still the same result in echo area.
> clojure-lsp --version
clojure-lsp 2024.02.01-11.01.59
clj-kondo 2023.12.16-SNAPSHOT
could you show a print? since I'm a lsp-mode user I think it should be a eglot issue since it works as expected on lsp-mode
I guess it's eglot then 😄 @UBRV1HXPD do you recall such weird issue with your eglot setup if you don't mind me asking (
also, it's weird that is not showing clojure.core/+
but +
:thinking_face: are you sure that is coming from LSP?
I think I disabled all the related cider doc, and lsp is the only one left? (cider-eldoc-display-for-symbol-at-point nil) (remove-hook 'eldoc-documentation-functions #'cider-eldoc t) my eldoc only has 2 lines of config as well so.. (eldoc-echo-area-use-multiline-p nil) (eldoc-echo-area-prefer-doc-buffer t)
https://github.com/joaotavora/eglot/discussions/1181 there's some relevant discussion there as well..let me double check with eglot. It seems to me eglot only use first line of eldoc's output by default..
I think that by default you get the “current arrity” in the minibuffer and once you write (xx a b) you will see b highlighted there. If I am right, this is the advantage / disadvantage of eglot over lsp-mode which doesn’t highlight current symbol but i would have to check it. Is that right?
well, after I upgraded to latest eglot master, at least it gets the “current arrity” in the minibuffer correct. I presume that's what you got as well and this is the correct expected behavior for eglot? @UBRV1HXPD
@U0599HVJX70 Yes, we are on track 🙂. Now - if you want to have all artiness on the same line (without highlighting the current one) you can add this to you configuration:
(defun my/switch-eldoc-eglot-fns ()
(when (derived-mode-p 'clojure-mode)
(remove-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function t)
(remove-hook 'eldoc-documentation-functions #'eglot-signature-eldoc-function t)
(add-hook 'eldoc-documentation-functions #'eglot-signature-eldoc-function -99 t)
(add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function -99 t)))
and then use this hook
(eglot-managed-mode . my/switch-eldoc-eglot-fns)
Now you will get the signature in mini-buffer (which is what is on 3rd line in your picture of eldoc-buffer).
I hope it will help you.