Fork me on GitHub
#lsp
<
2021-10-22
>
devn19:10:02

how do i get those fancy docs on highlight?

ericdallo19:10:39

there is lsp-ui-doc-glance I think

ericdallo19:10:43

or lsp-ui-doc-show

ericdallo19:10:52

you need lsp-ui package though

devn19:10:36

roger that. thanks.

devn19:10:50

so i think it’s doing that on highlight, but im not getting the actual clojure docs

ericdallo19:10:09

are you using latest clojure-lsp, I included a hot fix yesterday

devn19:10:27

i upgraded the cask today

devn19:10:43

brew upgrade clojure-lsp/brew/clojure-lsp-native

devn19:10:50

if that’s what you mean

devn19:10:30

but i did see clojure-lsp in brew, so perhaps that’s the right one to use these days?

ericdallo19:10:08

no, the native one is the correct, whats your clojure-lsp --version ?

devn20:10:19

clojure-lsp 2021.10.20-16.49.47
clj-kondo 2021.10.20-SNAPSHOT

devn20:10:42

looks like it’s working now 🤷

devn20:10:03

although, it doesn’t show the whole Examples section, it cuts off

ericdallo20:10:58

yeah, the hover via lsp-ui-doc is quite tricky like vscode

ericdallo20:10:14

I use doom-emacs, and K shows the docs as eldoc buffer and works perfectly

ericdallo20:10:25

I'm not sure how to achieve that without doom-emacs though :/

Proctor15:10:39

what action would one be seeing this under? is this from textDocument/signatureHelp ? textDocument/documentSymbol?

Proctor15:10:08

in nvim using nvim-lsp, so trying to figure out which call I should be looking for the feature under

ericdallo15:10:43

neither, it's textDocument/hover

Proctor15:10:13

awesome, will look for that new behavior in a bit

Asko Nōmm20:10:52

I got to say I’ve been longing for fancy docs after I switched to VS Code from Cursive, and am loving that it is now a thing. And if I understood correctly, it’s even better as it takes also docs for non-core packages from clojuredocs right?

ericdallo20:10:16

Thank you! The way it works is: when server starts we async request clojuredocs and cache all available docs, then when you hover over a symbol and request clojure-lsp docs about it, clojure-lsp merge the docs from clj-kondo that already exists with docs + examples + notes + see-alsos from the clojuredocs cache if any available

ericdallo20:10:45

so, if the symbol you request contains on http://clojuredocs.org then it should be available on clojure-lsp as well :)

Asko Nōmm20:10:57

This is effin rad!

🚀 3
borkdude21:10:32

Does it work in Calva already?

ericdallo21:10:09

that's the magic of LSP 😛

borkdude21:10:43

but I don't see it there either 😒

ericdallo21:10:47

I tested with calva when inplementing @U04V15CAJ

ericdallo21:10:02

@U04V15CAJ what's your clojure-lsp --version?

ericdallo21:10:27

does it contains the last fix I did about the native image missing protocol?

borkdude21:10:46

doesn't calva use the latest if you fill in latest?

borkdude21:10:06

when I type (inc 1) and hover inc, should it show me the docs for inc?

ericdallo21:10:23

yes, could you check the clojure-lsp log file?

ericdallo21:10:38

it should print a refreshed clojuredocs blablabla when starting

borkdude21:10:11

I'll reboot calva just to be sure

👍 1
ericdallo21:10:12

is clojure-lsp correctly connected? it's not even outputing the clj-kondo doc information

ericdallo21:10:32

it should print signature from kondo and doc as well

borkdude21:10:42

> clojure-lsp version used: 2021.10.20-16.49.47

👍 1
borkdude21:10:54

well I don't see anything. does it matter that I'm in a .cljs file?

borkdude21:10:35

nope, same thing in a .clj file

ericdallo21:10:49

hum, inc in a cljs buffer returns this: so clojuredocs not working for cljs?

borkdude21:10:19

I don't get anything in a .clj buffer either

ericdallo21:10:20

could you test on emacs?

borkdude21:10:33

no, on emacs I have to install other things that don't work

borkdude21:10:41

I never got it to work there

ericdallo21:10:49

does rename and other lsp features work?

borkdude21:10:20

yes navigation works

ericdallo21:10:45

could you test rename (`<F2>` AFAIK) as it uses source-paths from clojure-lsp

borkdude21:10:33

hmm, that didn't work

ericdallo21:10:36

the docs not showing even clj-kondo singature + docs it's already weird

ericdallo21:10:44

oh so it's a project configuration error probably

borkdude21:10:56

I don't have a deps.edn

borkdude21:10:59

because nbb :)

ericdallo21:10:00

clojure-lsp was not correctly started on the correct project-root or something

ericdallo21:10:10

oh, maybe that's the issue

borkdude21:10:10

I will create one

ericdallo21:10:46

actually, I think we could make clojure-lsp hover work even with projects that the classpath scan failed, I will try to improve that

borkdude21:10:30

I now have a proper setup I think, but rename still didn't work

borkdude21:10:47

but clojuredocs now works!

borkdude21:10:09

That's awesome :)

ericdallo21:10:34

rename probably didn't work because of clojure-lsp not finding the correct source-paths

ericdallo21:10:54

maybe we could improve clojure-lsp for nbb projects in the future

borkdude21:10:23

yeah, it's a similar problem as babashka I think

borkdude21:10:53

I have no plans for an nbb.edn yet though, perhaps package.json can be considered as a project root as well

ericdallo21:10:16

maybe, but there is already package.json for npx projects I think

ericdallo21:10:26

but yeah, we could fallback to nbb maybe

borkdude21:10:49

not so important for now, I already showed you one project where I solved it with a deps.edn

ericdallo21:10:49

actually, there is no rule for package.json ATM

ericdallo21:10:55

(defn ^:private default-project-specs []
  (->> [{:project-path "project.clj"
         :classpath-cmd ["lein" "classpath"]}
        {:project-path "deps.edn"
         :classpath-cmd ["clojure" "-A:dev:test" "-Spath"]}
        {:project-path "build.boot"
         :classpath-cmd ["boot" "show" "--fake-classpath"]}
        {:project-path "shadow-cljs.edn"
         :classpath-cmd ["npx" "shadow-cljs" "classpath"]}
        {:project-path "bb.edn"
         :classpath-cmd ["bb" "print-deps" "--format" "classpath"]}]
       (map #(update % :classpath-cmd classpath-cmd->windows-safe-classpath-cmd))))

ericdallo21:10:00

so that maybe could work

ericdallo21:10:30

it'd be better if there is some way to always know a project is nbb

ericdallo21:10:54

having a package.json is not entirely true, but sounds like a start

borkdude21:10:47

yeah we'll think about it

👍 1
Asko Nōmm23:10:03

So I was corrected on Twitter that apparently confused http://cljdoc.org with http://clojuredocs.org, that’s why I initially was amazed in thinking that it would also show docs for other packages, which I guess is not the case then. But that brings me to a question; is it possible to add http://cljdoc.org as well or maybe it’s not a good idea?

Asko Nōmm23:10:31

Just imagine if you’d also get docs for non-core packages!!!

Asko Nōmm23:10:25

Though maybe it makes little sense since I think most of it are just reflecting docstrings that we can see anyway. Welp, one can dream!

ericdallo23:10:53

Yeah, I didn't even know http://cljdoc.org 😅 If they only show docstrings I think this already works ATM with clj-kondo analysis, right?

ericdallo23:10:07

Oh I knew that site

ericdallo23:10:54

but yeah, it seems only indexes the docstring which is already available on clojure-lsp. does it allows other things like examples that are not inside the function docstring? I don't think so

Asko Nōmm23:10:03

It allows regular documentation, but no way to tie any of that to any particular function I think (example: https://cljdoc.org/d/lambdaisland/kaocha/1.0.937/doc/plugin-hooks)

ericdallo23:10:17

We hit 700 on GitHub 🎉 https://github.com/clojure-lsp/clojure-lsp

4
🌟 3
5
walterl00:10:33

Sorry to spoil the round number, but I just had to go make that 701 🙂

ericdallo00:10:03

haha thank you!