Skip to content
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

Doc/arglists coverage #822

Closed
mhuebert opened this issue Oct 24, 2022 · 5 comments
Closed

Doc/arglists coverage #822

mhuebert opened this issue Oct 24, 2022 · 5 comments

Comments

@mhuebert
Copy link
Contributor

mhuebert commented Oct 24, 2022

version

0.5.34

problem

Docs & arglists missing from things in clojure.core

repro

The following will return a map of missing metadata (where :doc is present in clojure.core but missing in sci):

(defn clojure-meta [name]
   (-> (resolve (symbol "clojure.core" (str name)))
       meta))

(into {}
       (for [[name var] (-> (sci/init {})
                            :env
                            deref
                            :namespaces
                            ('clojure.core))
             :let [sci-meta (meta var)]
             :when (not (:doc sci-meta))
             :let [m (clojure-meta name)]
             :when (:doc m)
             :let [m (select-keys m [:doc :arglists :macro :special-form])
                   m (apply dissoc m (keys sci-meta))]]
         [name m]))

Results: https://gist.github.com/mhuebert/72b6ee33e36c84754ae22205e6208bd8

expected behavior

I don't know if the goal is 100% coverage, but there are many commonly used macros (eg. when) that would benefit from :doc and :arglists. My use-case is the "eldoc" feature in Maria.cloud where we show usage info for the current operator.

Original discussion: https://clojurians.slack.com/archives/C015LCR9MHD/p1666643541901679

@borkdude
Copy link
Collaborator

As discussed, PR's welcome for all of those. You can trace back the places where to add them in namespaces.cljc.

@borkdude
Copy link
Collaborator

borkdude commented Oct 31, 2022

Updated list:

(*file* compare-and-set! *err* var? ns-aliases read ns-resolve *print-meta* ns-refers extend in-ns create-ns use reset! requiring-resolve require *clojure-version* instance? the-ns ns-name *out* ns-map swap! *in* descendants derive load-string ancestors intern ns-interns all-ns ns-imports alias read-string *ns* underive parents deref resolve with-redefs-fn)
(require '[sci.core :as sci])

(defn clojure-meta [name]
  (-> (resolve (symbol "clojure.core" (str name)))
      meta))

(for [[name var] (-> (sci/init {})
                     :env
                     deref
                     :namespaces
                     ('clojure.core))
      :let [sci-meta (meta var)]
      :when (not (:doc sci-meta))
      :let [m (clojure-meta name)]
      :when (:doc m)]
  name)

borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
@borkdude
Copy link
Collaborator

Added this patch to Clojure which corrects :dynamic var metadata for all dynamic vars, since copy-var now also picks up on that:

https://clojure.atlassian.net/browse/CLJ-2734

borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Oct 31, 2022
borkdude added a commit that referenced this issue Nov 1, 2022
borkdude added a commit that referenced this issue Nov 1, 2022
borkdude added a commit that referenced this issue Nov 1, 2022
@borkdude
Copy link
Collaborator

borkdude commented Nov 1, 2022

@mhuebert This issue should now completely be resolved. Thanks for the initial work on this!

@mhuebert
Copy link
Contributor Author

mhuebert commented Nov 2, 2022

@borkdude excellent, thank you!

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

No branches or pull requests

2 participants