Skip to content

Commit

Permalink
[docstring] Don't crash if string doc is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-yakushev committed Oct 9, 2024
1 parent be4b4ac commit 86db07a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bugs fixed

- [#3742](https://github.com/clojure-emacs/cider/issues/3742): Restore syntax highlighting in result minibuffer.
- [#3747](https://github.com/clojure-emacs/cider/issues/3747): Fix errors when docstring is nil.

## 1.16.0 (2024-09-24)

Expand Down
7 changes: 4 additions & 3 deletions cider-docstring.el
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ Prioritize rendering as much as possible while staying within `cider-docstring-m

(cl-defun cider-docstring--trim (string &optional (max-lines cider-docstring-max-lines))
"Return MAX-LINES of STRING, adding \"...\" if trimming was necessary."
(let* ((lines (split-string string "\n"))
(string (string-join (seq-take lines max-lines) "\n")))
(concat string (when (> (length lines) max-lines) "..."))))
(when string
(let* ((lines (split-string string "\n"))
(string (string-join (seq-take lines max-lines) "\n")))
(concat string (when (> (length lines) max-lines) "...")))))

(defun cider-docstring--format (string)
"Return a nicely formatted STRING to be displayed to the user.
Expand Down

0 comments on commit 86db07a

Please sign in to comment.