Skip to content

Commit

Permalink
Fix: Do not call cider-docstring fns unless we have a doc
Browse files Browse the repository at this point in the history
Sometimes, there is no "doc" attribute in the nrepl-dict. In such
cases, `fetched-doc` is nil, which causes `cider-docstring--*`
functions to error.

We should only call these functions when we have a docstring to
render.

Fixes: #3763
  • Loading branch information
vedang committed Dec 18, 2024
1 parent 588c579 commit 728f298
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cider-doc.el
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,11 @@ in a COMPACT format is specified, FOR-TOOLTIP if specified."
"doc-first-sentence-fragments" (nrepl-dict-get info "doc-first-sentence-fragments"))))
(fetched-doc (nrepl-dict-get info "doc"))
(doc (or rendered-fragments
(if compact
(cider-docstring--trim
(cider-docstring--format fetched-doc))
fetched-doc)
(when fetched-doc
(if compact
(cider-docstring--trim
(cider-docstring--format fetched-doc))
fetched-doc))
(unless compact
"Not documented.")))
(url (nrepl-dict-get info "url"))
Expand Down

0 comments on commit 728f298

Please sign in to comment.