clojure-emacs / clojure-emacs/orchard

Cider-doc cannot lookup Closure and other Clojurescript dependencies

Open
#203 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
340
Forks
52
Avg merge
55m
Merged PRs (30d)
5

Description

## 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} 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.