-
-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClojureDocs formatting tweaks #3701
ClojureDocs formatting tweaks #3701
Conversation
b9e6911
to
ae5cd39
Compare
cider-clojuredocs.el
Outdated
(when-let ((doc (nrepl-dict-get dict "doc"))) | ||
(insert "\n") | ||
(let ((lines (mapcar (lambda (line) | ||
(replace-regexp-in-string "^\s+" "" line)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use string-trim-left
?
One thing to consider here, though, is how much to strip exactly, as I'm guessing that some docstrings might have intentional indentation on some lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, string-trim-left
will suffice in that case.
I'm not sure why we get these spaces in the docstring in the first place. Maybe it has something to do with ClojureDocs data.
But we can be sure that every line after the first one contains two additional spaces at the beginning, so maybe just removing exactly two spaces will be good enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, they are here because this is a literal string from the source code. As there are generally two spaces at the beginning of lines in docstrings, I guess it will be okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I'm also not sure where those spaces are coming from, but I guess your solution is unlikely to break something in the formatting.
ae5cd39
to
2bebbba
Compare
cider-clojuredocs.el
Outdated
(insert (nrepl-dict-get dict "doc")) | ||
(insert "\n")) | ||
(when-let ((doc (nrepl-dict-get dict "doc"))) | ||
(insert "\n" (replace-regexp-in-string "\n " "\n" doc) "\n"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a note here regarding the need to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a note.
2bebbba
to
f2553a6
Compare
I plan to rework how ClojureDocs buffer is displayed (improve some formatting, make it more modular and customizable) and want to start with some small improvements.
This particular change:
*
and newline are no longer part of the button.This is how it looked before:
This is how it looks now: