Skip to content

Cider-doc cannot lookup Closure and other Clojurescript dependencies #203

Open
@derinsh0

Description

@derinsh0

Expected behavior

Cider-doc should resolve symbols from dependencies such as Google Closure and attempt to evaluate their doc-string if no other source of documentation is available.

Actual behavior

Running cider-doc on the function goog.dom/createElement will give "symbol not resolved".

But that function has a valid, if somewhat crude, docstring that cider can evaluate with (:doc (meta #'goog.dom/createElement)) or (clojure.repl/doc goog.dom/createElement) which gives:

-------------------------
goog.dom/createElement
([name])
  /**
 * Creates a new element.
 * @param {string|!goog.dom.TagName<T>} name Tag to create.
 * @return {R} The new element. The return type is {!Element} if name is
 *     a string or a more specific type if it is a member of goog.dom.TagName
 *     (e.g. {!HTMLAnchorElement} for goog.dom.TagName.A).
 * @template T
 * @template R := cond(isUnknown(T), 'Element', T) =:
 */
nil

As a comparison. Function meta is lookable with cider-doc. Which opens:

cljs.core/meta
[o]
Returns the metadata of obj, returns nil if there is no metadata.

cljs.core/meta is defined in

jar:file:/C:/Users/x/.m2/repository/org/clojure/clojurescript/1.11.4/clojurescript-1.11.4.jar!/cljs/core.cljs.

But evaluating (meta #'meta) says the function is located at :

{...
:file "cljs/core.cljs"
...}

While (meta #'goog.dom/createElement) :

:file "file:/C:/Users/x/.m2/repository/org/clojure/google-closure-library/0.0-20211011-0726fdeb/google-closure-library-0.0-20211011-0726fdeb.jar!/goog/dom/dom.js"

Maybe the issue is finding it?

Steps to reproduce the problem

Create a figwheel-main cljs project and jack-in with cider. Import namespace goog.dom and lookup any of its functions with cider-doc.

Environment & Version information

CIDER version information

;; CIDER 1.5.0-snapshot (package: 20220628.551), nREPL 0.9.0
;; Clojure 1.10.0, Java 17.0.3.1

Lein / Clojure CLI version

Clj win-install-1.11.1.1149.ps1

Emacs version

29.0.50

Operating system

Windows 10

JDK distribution

java version "17.0.3.1" 2022-04-22 LTS
Java(TM) SE Runtime Environment (build 17.0.3.1+2-LTS-6)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.3.1+2-LTS-6, mixed mode, sharing)

P.S.

I don't know CIDER enough to decide if this is a bug or missing feature.

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