calva icon indicating copy to clipboard operation
calva copied to clipboard

help strings not formatted as expected

Open jamiepratt opened this issue 1 year ago • 1 comments

Hi Pez,

I made a minimal repo for a shadow-cljs project that requires fulcro and replicated this issue on my machine.

https://github.com/jamiepratt/calva-help-string

Here's a screenshot of the doc string displayed when hovering over the function name:

Screenshot 2024-05-19 at 13 12 09

In this case my workaround of hovering over the first param is not displaying a helpstring at all, not sure why it worked in my code base and is not working here.

Screenshot 2024-05-19 at 13 14 21

Jamie

jamiepratt avatar May 19 '24 11:05 jamiepratt

Hi! Thanks for reporting. I can reproduce it.

What trips Calva up is the indentation before the list. We can make the foo function in the repro misbehave the same way, like so:

(defn foo
 "Increments x if it is positive, otherwise returns x.
    - x: a number
    - returns: a number"
  [x]
  (if (pos? x)
    (inc x)
    x))

Not sure what we can do about it. We use VS Code API for making a MarkdownString from the doc string. Maybe the indents are non-standard Markdown?

It seems like clojure-lsp handles it, though. Disconnecting the REPL we get nicely formatted doc strings. Maybe that was what made your workaround work, cojure-lsp got to handle it, or something.

PEZ avatar May 19 '24 11:05 PEZ