Skip to content

Commit

Permalink
Tweak docstring of cider-docstring--format and remove redundant comment
Browse files Browse the repository at this point in the history
  • Loading branch information
katomuso authored and bbatsov committed Jun 11, 2024
1 parent 39ed671 commit 451f72e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cider-docstring.el
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,14 @@ Prioritize rendering as much as possible while staying within `cider-docstring-m
(concat string (when (> (length lines) max-lines) "..."))))

(defun cider-docstring--format (string)
"Return a nicely formatted STRING to be displayed to the user."
;; As this is a literal docstring from the source code and
;; there are two spaces at the beginning of lines in docstrings,
;; we remove them to make it align nicely when it is displayed.
"Return a nicely formatted STRING to be displayed to the user.
We need to format the docstring before displaying it to the user
because it is obtained from the source code. For example, this means
that it usually has two spaces before each line used for indentation
\(see https://guide.clojure.style/#docstring-indentation). While displaying
the docstring to the user, we usually want to control indentation and
other aspects of the presentation, so we format it before displaying."
(replace-regexp-in-string "\n " "\n" string))

(provide 'cider-docstring)
Expand Down

0 comments on commit 451f72e

Please sign in to comment.