Skip to content

Commit

Permalink
[Fix #3763] Do not call cider-docstring fns unless we have a doc (#3764)
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.
  • Loading branch information
vedang authored Dec 23, 2024
1 parent 588c579 commit 430cfd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Bugs fixed

- [#3763](https://github.com/clojure-emacs/cider/issues/3763): Fix `cider-docview-render` completion popup error when symbol being completed does not have a docstring.

## 1.16.1 (2024-12-03)

### Changes
Expand Down
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 430cfd4

Please sign in to comment.