Skip to content

Filter special form symbols from eldoc args list #166

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

Merged
merged 1 commit into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/orchard/eldoc.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
(defn- extract-eldoc
[info]
(if-let [arglists (seq (-> info extract-arglists format-arglists))]
{:eldoc arglists :type "function"}
{:eldoc arglists
:type (cond
(:special-form info) "special-form"
(:macro info) "macro"
:else "function")}
{:type "variable"}))

(defn eldoc
Expand Down
12 changes: 12 additions & 0 deletions test/orchard/eldoc_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@
(is (:eldoc result))
(is (:docstring result))))

(testing "Clojure special form"
(let [result (eldoc/eldoc (info/info 'clojure.core 'if))]
(is (= (:type result) "special-form"))))

(testing "Clojure macro"
(let [result (eldoc/eldoc (info/info 'clojure.core 'when))]
(is (= (:type result) "macro"))))

(testing "Clojure function"
(let [result (eldoc/eldoc (info/info 'clojure.core 'inc))]
(is (= (:type result) "function"))))

(testing "Java result structure"
(let [result (eldoc/eldoc (info/info-java 'java.lang.String 'toLowerCase))]
(is (:class result))
Expand Down