Skip to content

ClojureScript declared functions are missing metadata #2730

@danielcompton

Description

@danielcompton

If you look up the definition for reset! in CLJS, it takes you to

https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L7272

instead of

https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L4521-L4524

This means that the docstrings don't show up:

Screenshot of IntelliJ IDEA (15-09-22, 11-57-04 AM)

Perhaps a duplicate root cause with #438

Although thinking about it now, maybe this is expected behaviour because the declare is after the defn.

Update, I think Cursive is correct in it's parsing, but it could be more helpful by keeping the docstring when it encounters a declare:

(defn my-func "This is a docstring" [x] (inc x))
(prn (meta #'my-func))

(declare my-func)

(prn (meta #'my-func))
=> #'emails.reply-parser.html-test/my-func
{:arglists ([x]), :doc "This is a docstring", :line 1, :column 1, :file "/private/var/folders/d3/sd0zhwhj7pg3q596qc88hsnm0000gn/T/form-init5107905847687682438.clj", :name my-func, :ns #object[clojure.lang.Namespace 0x170c4b8e "emails.reply-parser.html-test"]}
=> nil
=> #'emails.reply-parser.html-test/my-func
{:declared true, :line 4, :column 1, :file "/private/var/folders/d3/sd0zhwhj7pg3q596qc88hsnm0000gn/T/form-init5107905847687682438.clj", :name my-func, :ns #object[clojure.lang.Namespace 0x170c4b8e "emails.reply-parser.html-test"]}
=> nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions