-
Notifications
You must be signed in to change notification settings - Fork 176
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
Add a middleware to find docs from ClojureDocs #628
Conversation
77c98b2
to
ececb7d
Compare
src/cider/nrepl.clj
Outdated
@@ -478,12 +478,32 @@ | |||
:returns {"fn-deps" "A list of function deps." | |||
"status" "done"}}}}) | |||
|
|||
(def-wrapper wrap-clojuredocs cider.nrepl.middleware.clojuredocs/handle-clojuredocs | |||
{:doc "Middleware to find a documents from ClojureDocs." | |||
:handles {"load-clojuredocs-cache!" |
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 don't think clients will need to call this explicitly, probably they'll just need the ability to reload the cache.
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.
Apart from refreshing cache, I thought it could be used for cache loading in the background (e.g. when connecting nREPL).
But once the cache file is generated, loading of the cache is fast enough, so it seems that just refreshing is good.
src/cider/nrepl.clj
Outdated
:requires {} | ||
:optional {"export-edn-url" "EDN file URL exported from ClojureDocs. Defaults to \"https://clojuredocs-edn.netlify.com/export.edn\"."} | ||
:returns {"status" "\"ok\" if loading was successful"}} | ||
"clean-clojuredocs-cache!" |
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.
Same with this one - probably we can expose a single "clojuredocs-refresh-cache" op instead of two.
src/cider/nrepl.clj
Outdated
{:doc "Clean a cached file and documents" | ||
:requires {} | ||
:returns {"status" "\"ok\" if cleaning was successful"}} | ||
"clojuredocs" |
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 think clojuredocs-lookup
is a more informative name for this one.
Makefile
Outdated
.inline-deps: | ||
lein inline-deps | ||
touch .inline-deps | ||
|
||
inline-deps: .inline-deps | ||
|
||
test: .inline-deps | ||
test: .inline-deps test/resources/clojuredocs/export.edn |
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.
It's best to put resources under the cider/nrepl
package for consistency with the existing resources.
ececb7d
to
2cdc44b
Compare
@bbatsov Thank you for your reviewing! |
Excellent! I'll cut a new beta now. |
Introduce a middleware to find docs from not Grimoire but ClojureDocs.
See also clojure-emacs/cider#2663 and clojure-emacs/orchard#64