Skip to content

Commit 451f72e

Browse files
katomusobbatsov
authored andcommitted
Tweak docstring of cider-docstring--format and remove redundant comment
1 parent 39ed671 commit 451f72e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cider-docstring.el

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,14 @@ Prioritize rendering as much as possible while staying within `cider-docstring-m
148148
(concat string (when (> (length lines) max-lines) "..."))))
149149

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

157161
(provide 'cider-docstring)

0 commit comments

Comments
 (0)