calva icon indicating copy to clipboard operation
calva copied to clipboard

Doc string from "dynamic interned vars" is not shown in completion details

Open behrica opened this issue 1 year ago • 10 comments

If I define a var and its doc string dynamically:

(intern 'clojure.core
          (vary-meta
           'test123
           assoc
           :doc "doc of test")
          (fn [a b c]
            (+ a b c))
          )

and the try to complete it via

(clojure.core/test1...)

then VSCode / Calva does not render the doc string in the completion details. (only the args are shown) while it does so for other vars in clojure.core.

Description with screenshots is here: https://app.slack.com/client/T03RZGPFR/CBE668G4R

behrica avatar May 10 '24 13:05 behrica

It does work for "hover" over the var, there the doc string is shown, only missing while completing.

behrica avatar May 10 '24 13:05 behrica

we would like to have this working due to tghis work ongoing: https://github.com/scicloj/clojisr/pull/98

This would render the "help" of "R functions" expressed as Clojure vars. It does work in Emacs.

behrica avatar May 10 '24 13:05 behrica

Yeah, it's intended to work.

PEZ avatar May 10 '24 13:05 PEZ

One different between "hover logic" and "completion logic" is this:

if (util.getConnectedState())

vs

if (util.getConnectedState() && item['data']?.provider === 'repl') {

behrica avatar May 10 '24 13:05 behrica

any new on this ?

behrica avatar Sep 21 '24 19:09 behrica

Hello. I had completely forgotten about this. I'm sorry!

Now checked and from what I can see we do have the docs in the results from nrepl, but we somehow bork it in our InfoParser. Here's the call:

https://github.com/BetterThanTomorrow/calva/blob/published/src/providers/completion.ts#L111

I don't think it should be too hard to fix. Do you want to have a go at it? Otherwise I will get to it some day soon.

PEZ avatar Sep 21 '24 20:09 PEZ

Any progress on this ? We are working on a new feature in https://github.com/scicloj/clojisr, which would dynamically attach "doc" metadata to the synthetic clojure functions we create for R functions.

Without this being fixed, Calva would not show this clojuredoc, while Cider would

behrica avatar Jan 14 '25 19:01 behrica

Ah, you never replied if you wanted to have a go at it. I take this as a no? 😄

PEZ avatar Jan 14 '25 20:01 PEZ

no, thanks for the offer.

I have no idea about TypeScript or vscode plugins, and don't really want to learn about it... I like Clojure...

behrica avatar Jan 14 '25 21:01 behrica

There is now an other case, where we "update" doc strings dynamicaly: https://github.com/scicloj/metamorph.ml/blob/8a70f50da45cbdc135bf01925cf7bd1776b6838e/src/scicloj/metamorph/ml/rdatasets.clj#L14243

and it would be nice if Calva would render them

behrica avatar Feb 09 '25 17:02 behrica