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

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

Open
derinsh0 opened this issue Jul 21, 2022 · 4 comments
Open

Comments

@derinsh0
Copy link

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.

@bbatsov
Copy link
Member

bbatsov commented Jul 22, 2022

Can you post here the relevant message exchange with nREPL? (see https://docs.cider.mx/cider/troubleshooting.html#debugging-the-communication-with-nrepl)

@derinsh0
Copy link
Author

Can you post here the relevant message exchange with nREPL? (see https://docs.cider.mx/cider/troubleshooting.html#debugging-the-communication-with-nrepl)

Yes, but it doesn't say that much.

(-->
  id         "179"
  op         "eldoc"
  session    "e9fdf778-baa0-4512-9dc6-d8c200594826"
  time-stamp "2022-07-24 01:59:20.305304000"
  ns         #("lcljs.temp" 0 10 (cider-block-dynamic-font-lock t cider-locals nil help-echo cider--help-echo fontified nil))
  sym        "gdom/getElement"
)
(<--
  id         "179"
  session    "e9fdf778-baa0-4512-9dc6-d8c200594826"
  time-stamp "2022-07-24 01:59:20.314077000"
  status     ("done" "no-eldoc")
)
(-->
  id         "180"
  op         "info"
  session    "e9fdf778-baa0-4512-9dc6-d8c200594826"
  time-stamp "2022-07-24 01:59:23.149347000"
  ns         #("lcljs.temp" 0 10 (cider-block-dynamic-font-lock t cider-locals nil help-echo cider--help-echo fontified nil))
  sym        "gdom/getElement"
)
(<--
  id         "180"
  session    "e9fdf778-baa0-4512-9dc6-d8c200594826"
  time-stamp "2022-07-24 01:59:23.151240000"
  status     ("done" "no-info")
)
(-->
  id         "181"
  op         "eldoc"
  session    "e9fdf778-baa0-4512-9dc6-d8c200594826"
  time-stamp "2022-07-24 01:59:23.957024000"
  ns         #("lcljs.temp" 0 10 (cider-block-dynamic-font-lock t cider-locals nil help-echo cider--help-echo fontified nil))
  sym        "gdom/getElement"
)
(<--
  id         "181"
  session    "e9fdf778-baa0-4512-9dc6-d8c200594826"
  time-stamp "2022-07-24 01:59:23.966280000"
  status     ("done" "no-eldoc")
)

Cider-browse-ns won't find goog.dom either.

@bbatsov
Copy link
Member

bbatsov commented Jul 24, 2022

My guess would be that this doesn't work for JavaScript sources, but I don't do ClojureScript myself and I don't remember much of the relevant code in Orchard at this point. Perhaps @arichiardi can shed more light on this.

@vemv vemv transferred this issue from clojure-emacs/cider Oct 28, 2023
@vemv
Copy link
Member

vemv commented Oct 28, 2023

(moved from cider to Orchard)

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

3 participants