clojure-emacs / cider

The Clojure Interactive Development Environment that Rocks for Emacs
https://cider.mx
GNU General Public License v3.0
3.52k stars 643 forks source link

Split `cider-docstring--dumb-trim` into two single-purpose functions #3708

Closed katomuso closed 4 weeks ago

katomuso commented 4 weeks ago

The function cider-docstring--dumb-trim performs both formatting and trimming. I propose splitting it into two separate functions: cider-docstring--trim and cider-docstring--format because these two functionalities are needed in different contexts. For example, we need to format the docstring when displaying it in the documentation buffer, and we need to trim the docstring when displaying it in the minibuffer or in a popup along with completions.

katomuso commented 4 weeks ago

To easily verify that it doesn't change the output, you can use the following snippet:

(let* ((info (cider-var-info "clojure.core/reduce"))
       (doc (nrepl-dict-get info "doc")))
  (string= (cider-docstring--dumb-trim doc)
           (cider-docstring--trim (cider-docstring--format doc))))
vemv commented 4 weeks ago

Thanks!