-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
Fix: Do not call cider-docstring fns unless we have a doc #3764
base: master
Are you sure you want to change the base?
Conversation
Sometimes, there is no "doc" attribute in the nrepl-dict. In such cases, `fetched-doc` is nil, which causes `cider-docstring--*` functions to error. We should only call these functions when we have a docstring to render. Fixes: clojure-emacs#3763
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.
lgtm, thanks!
(if compact | ||
(cider-docstring--trim | ||
(cider-docstring--format fetched-doc)) | ||
fetched-doc)) | ||
(unless compact |
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.
Btw, this unless
looks weird to me. Shouldn't this also check fetched-doc
?
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.
My understanding of the code is:
- Return
rendered-fragments
if we already have them - Else return the
fetched-doc
(handle optionalcompact
flag, depending on where the doc is being rendered) - Else return "Not documented" for when we are rendering in Help buffer, or return nothing if rendering an e.g. completion popup.
Only code-path 2 deals with fetched-doc. Others don't.
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.
This part I get - I'm just confused how can a check about compact
be related to the presence or absence of a docstring. I know it's not directly related to your PR - it's just something that looks wrong to me, so I thought I should mention it.
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.
If the caller is asking for a compact docstring, and no docstring exists, return nil. If the caller is asking for an "expanded" docstring, and no docstring exists, return "not documented".
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.
Yeah, yeah - I get this part. I was just wondering why "not documented" is not a good option in both cases. Anyways, not a big deal.
Just add a changelog for your bigfix and we're good go. |
Sometimes, there is no "doc" attribute in the nrepl-dict. In such cases,
fetched-doc
is nil, which causescider-docstring--*
functions to error.We should only call these functions when we have a docstring to render.
Fixes: #3763
Replace this placeholder text with a summary of the changes in your PR.
The more detailed you are, the better.
Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
eldev test
)eldev lint
) which is based onelisp-lint
and includescheckdoc
, check-declare, packaging metadata, indentation, and trailing whitespace checks.Thanks!