Skip to content

Commit

Permalink
Disable the enhanced cljs completion
Browse files Browse the repository at this point in the history
This breaks on load time with shadow-cljs 2.10.x. We'll enable it back
once suitable gets updated.
  • Loading branch information
bbatsov committed Jun 16, 2020
1 parent 4ec02a7 commit ed79316
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
4 changes: 1 addition & 3 deletions src/cider/nrepl/middleware/complete.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
[compliment.core :as complete]
[compliment.utils :as complete-utils]
[orchard.misc :as misc]
[suitable.complete-for-nrepl :as suitable]
[suitable.compliment.sources.cljs :as suitable-sources]))

(def clj-sources
Expand Down Expand Up @@ -36,8 +35,7 @@
:extra-metadata (set (map keyword extra-metadata))}]
(if-let [cljs-env (cljs/grab-cljs-env msg)]
(binding [suitable-sources/*compiler-env* cljs-env]
(concat (complete/completions prefix (merge completion-opts {:sources cljs-sources}))
(when enhanced-cljs-completion? (suitable/complete-for-nrepl (assoc msg :symbol prefix)))))
(complete/completions prefix (merge completion-opts {:sources cljs-sources})))
(complete/completions prefix (merge completion-opts {:sources clj-sources})))))

(defn completion-doc
Expand Down
54 changes: 27 additions & 27 deletions test/cljs/cider/nrepl/middleware/cljs_complete_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,35 @@
(is (= '("[psym & doc+methods]") (:arglists candidate)))
(is (string? (:doc candidate))))))

(deftest cljs-complete-with-suitable-test
(testing "js global completion"
(let [response (session/message {:op "complete"
:ns "cljs.user"
:prefix "js/Ob"
:enhanced-cljs-completion? "t"})
candidates (:completions response)]
(is (= [{:candidate "js/Object", :ns "js", :type "function"}] candidates))))
;; (deftest cljs-complete-with-suitable-test
;; (testing "js global completion"
;; (let [response (session/message {:op "complete"
;; :ns "cljs.user"
;; :prefix "js/Ob"
;; :enhanced-cljs-completion? "t"})
;; candidates (:completions response)]
;; (is (= [{:candidate "js/Object", :ns "js", :type "function"}] candidates))))

(testing "manages context state"
(session/message {:op "complete"
:ns "cljs.user"
:prefix ".xxxx"
:context "(__prefix__ js/Object)"
:enhanced-cljs-completion? "t"})
(let [response (session/message {:op "complete"
:ns "cljs.user"
:prefix ".key"
:context ":same"
:enhanced-cljs-completion? "t"})
candidates (:completions response)]
(is (= [{:ns "js/Object", :candidate ".keys" :type "function"}] candidates))))
;; (testing "manages context state"
;; (session/message {:op "complete"
;; :ns "cljs.user"
;; :prefix ".xxxx"
;; :context "(__prefix__ js/Object)"
;; :enhanced-cljs-completion? "t"})
;; (let [response (session/message {:op "complete"
;; :ns "cljs.user"
;; :prefix ".key"
;; :context ":same"
;; :enhanced-cljs-completion? "t"})
;; candidates (:completions response)]
;; (is (= [{:ns "js/Object", :candidate ".keys" :type "function"}] candidates))))

(testing "no suitable completions without enhanced-cljs-completion? flag"
(let [response (session/message {:op "complete"
:ns "cljs.user"
:prefix "js/Ob"})
candidates (:completions response)]
(is (empty? candidates)))))
;; (testing "no suitable completions without enhanced-cljs-completion? flag"
;; (let [response (session/message {:op "complete"
;; :ns "cljs.user"
;; :prefix "js/Ob"})
;; candidates (:completions response)]
;; (is (empty? candidates)))))

(deftest cljs-complete-doc-test
(testing "no suitable documentation can be found"
Expand Down

0 comments on commit ed79316

Please sign in to comment.