Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Docstrings not available for some re-frame.core functions #456

Closed
rads opened this issue Mar 7, 2018 · 3 comments
Closed

Docstrings not available for some re-frame.core functions #456

rads opened this issue Mar 7, 2018 · 3 comments
Assignees

Comments

@rads
Copy link

rads commented Mar 7, 2018

The re-frame.core namespace includes this comment:

;; So, we promote a `defn` in a deeper namespace "up" to the API
;; via a `def` in this namespace.
;;
;; Turns out, this approach makes it hard:
;;   - to auto-generate API docs
;;   - for IDEs to provide code completion on functions in the API

As a Cursive user I see that the docstring is parsed using static analysis on the Clojure code. This means there's no way to copy the docstring from another function without changing how Cursive currently works.

This forces libraries to make a decision: do we put the docstring on the inner function or the outer one? Re-frame currently keeps the docstring on the inner function. Unfortunately that results in a developer experience like this:

monosnap 2018-03-06 19-10-45

This is confusing and inconvenient for the most common use case. I suggest that we move the docstring to the outer function to allow the docstring to show up as it should:

monosnap 2018-03-06 19-18-54

We can replace the docstring of the inner function with instructions to find the canonical docstring:

monosnap 2018-03-06 19-16-01

I work with many people who are just getting started with Re-frame. For beginners the docstrings are a vital part of the development experience. In exchange for a little internal ugliness we can optimize for the most common use case and improve the usability of the library for everyone.

@danielcompton
Copy link
Contributor

danielcompton commented Mar 7, 2018

See also #257 and cursive-ide/cursive#1073.

Edit: not that Cursive issue, cursive-ide/cursive#944 as Colin notes below is the right one.

@cursive-ide
Copy link

The relevant Cursive issue is cursive-ide/cursive#944. I'll see if I can address this on the Cursive side soon, since this is a common issue with several popular libraries.

@superstructor
Copy link
Contributor

Duplicate of #216. Both are now fixed. See comment in that issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants