Skip to content

Commit

Permalink
info and eldoc ops: fix regression for the special form .. (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
vemv committed Sep 23, 2023
1 parent d39c735 commit 247071b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Bugs Fixed

* `info` and `eldoc` ops: fix regression for the special form `..`.

## 0.38.1 (2023-09-21)

* Bump `orchard` to [1.5.1](https://github.com/clojure-emacs/orchard/blob/v0.15.1/CHANGELOG.md#0151-2023-09-21).
Expand Down
4 changes: 3 additions & 1 deletion src/cider/nrepl/middleware/info.clj
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@
(symbol class))
.getName))
(not-empty class)
(when (some-> sym (str/starts-with? "."))
(when (and (some-> sym (str/starts-with? "."))
;; .. cannot be a class member, so class inference doesn't make sense here:
(not= sym ".."))
(extract-class-from-compliment ns context)))
(catch Exception e
nil))
Expand Down
8 changes: 6 additions & 2 deletions test/clj/cider/nrepl/middleware/info_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@
(testing "A `:context` can disambiguate input, reducing the `:candidates` to just one"
(let [base {:ns (str *ns*)
:symbol ".codePointCount"}
base-with-context (assoc base :context "(let [v \"\"] \n (__prefix__ v))")
response-without-context (info/info base)
response-with-context (info/info (assoc base :context "(let [v \"\"] \n (__prefix__ v))"))]
response-with-context (info/info base-with-context)]
(is (= '[java.lang.String java.lang.StringBuffer java.lang.Character java.lang.StringBuilder]
(-> response-without-context :candidates keys)))
(is (not (:candidates response-with-context)))
(is (= `String
(:class response-with-context))))))
(:class response-with-context)))
(is (= {:added "1.0", :ns 'clojure.core, :name '.., :file "clojure/core.clj"}
(-> base-with-context (assoc :symbol "..") info/info (select-keys [:class :added :ns :name :file])))
"The context is ignored for the special form `..`"))))

;; Used below in an integration test
(def ^{:protocol #'clojure.data/Diff} junk-protocol-client nil)
Expand Down

0 comments on commit 247071b

Please sign in to comment.