clojure-emacs / cider

The Clojure Interactive Development Environment that Rocks for Emacs
https://cider.mx
GNU General Public License v3.0
3.55k stars 645 forks source link

`cider-doc` not recognize the right function. #3734

Closed eval-exec closed 1 month ago

eval-exec commented 3 months ago

I am experiencing an issue with cider-doc in CIDER. Specifically, when I place the cursor on string/join in my Clojure code and invoke the cider-doc command, it seems cider-doc not recgnize the join is from clojure.string/join.

Expected behavior

When I hit K, cider-doc should show clojure.string/join's doc

Actual behavior

cider-doc give me a prompt, I have to type full clojure.string/join to cider-doc's prompt

Steps to reproduce the problem

  1. git clone https://github.com/functional-koans/clojure-koans.git
  2. open 02_strings.clj file, move cursor to line 28: (= "123" (string/join '(1 2 3)))
  3. put cursor to join word. hit K (cider-doc)

Environment & Version information

CIDER version information

Include here the version string displayed when CIDER's REPL is launched. Here's an example:

;; CIDER 0.12.0snapshot (package: 20160331.421), nREPL 0.2.12
;; Clojure 1.8.0, Java 1.8.0_31

;; Connected to nREPL server - nrepl://localhost:38447
;; CIDER 1.15.1 (Cogne), nREPL 1.3.0-beta3
;; Clojure 1.10.0, Java 21.0.3
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;

Lein / Clojure CLI version

Leiningen 2.10.0 on Java 21.0.3 OpenJDK 64-Bit Server VM

Emacs version

GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.42, cairo version 1.18.0) of 2024-08-16

Operating system

❯ nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.45, NixOS, 24.05 (Uakari), 24.05.20240813.4a92571`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(exec): `""`
 - channels(root): `""`
 - nixpkgs: `/nix/store/qszplw617r895nbcprgyj139c9a3r0xs-source`

JDK distribution

openjdk-21.0.3

❯ env | grep JAVA
JAVA_HOME=/nix/store/y9dcp2rgh70wz2q3nybv45k8zaz3jdwa-openjdk-21.0.3+9/lib/openjdk
vemv commented 3 months ago

Hi @eval-exec, thanks for the report.

I use cider-doc quite often and haven't experienced that.

Are you aware that the ns form where the string alias is declared has to be evaluated (in some or other way) for CIDER to be able to see it?

i.e. since the tool is based on runtime analysis, the alias must exist in the runtime first.

eval-exec commented 3 months ago

Hi @eval-exec, thanks for the report.

I use cider-doc quite often and haven't experienced that.

Are you aware that the ns form where the string alias is declared has to be evaluated (in some or other way) for CIDER to be able to see it?

i.e. since the tool is based on runtime analysis, the alias must exist in the runtime first.

Thank you, I guess there something wrong in my local env. I think it's not important.

Is there some ways to help to debug why cider-doc not aware the join is from clojure.string/join?

eval-exec commented 3 months ago

Wow, I just try cider-doc on join, it works as expected, I don't know why. :smile:

bbatsov commented 1 month ago

I guess we can close this issuel