diff --git a/README.md b/README.md index d6f1efa..9533bc5 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ me know if you are! Thanks to the developers of [Clojure](https://github.com/clojure/clojure), [JLine](https://github.com/jline/jline2), [nREPL](https://github.com/clojure/tools.nrepl), -[clojure-complete](https://github.com/ninjudd/clojure-complete), +[compliment](https://github.com/alexander-yakushev/compliment), [ClojureDocs](http://clojuredocs.org), and [clojuredocs-client](https://github.com/dakrone/clojuredocs-client), for their work on the excellent projects that this project depends upon. diff --git a/project.clj b/project.clj index 27bc6bb..cc16667 100644 --- a/project.clj +++ b/project.clj @@ -11,7 +11,7 @@ [org.clojure/tools.cli "0.3.1"] [com.cemerick/drawbridge "0.0.6"] [trptcolin/versioneer "0.1.1"] - [clojure-complete "0.2.3"] + [compliment "0.2.0"] [net.cgrand/sjacket "0.1.1" :exclusions [org.clojure/clojure]]] :min-lein-version "2.0.0" diff --git a/spec/reply/reader/jline/completion_spec.clj b/spec/reply/reader/jline/completion_spec.clj index a20a27c..f919d14 100644 --- a/spec/reply/reader/jline/completion_spec.clj +++ b/spec/reply/reader/jline/completion_spec.clj @@ -4,8 +4,8 @@ (describe "construct-possible-completions-form" (it "does correct quoting in completions form request" - (should= '(complete.core/completions (str "clojure.core/map-") (symbol "user")) - (construct-possible-completions-form "clojure.core/map-" "user")))) + (should= '(compliment.core/completions (str "clojure.core/map-") (symbol "user") nil) + (construct-possible-completions-form "clojure.core/map-" "user")))) (describe "using the completer" @@ -17,7 +17,7 @@ (it "populates the list with possible completions" (let [candidates (java.util.LinkedList.) word-start (.complete @completer " (map" 5 candidates)] - (should= ["map" "map-indexed" "map?" "mapcat" "mapv"] + (should= ["map" "map?" "mapv" "mapcat" "map-indexed"] candidates) (should= 1 @@redraw-count) (should= 2 word-start))) diff --git a/src/clj/reply/initialization.clj b/src/clj/reply/initialization.clj index 71f9a54..e3bfe1a 100644 --- a/src/clj/reply/initialization.clj +++ b/src/clj/reply/initialization.clj @@ -3,6 +3,7 @@ [clojure.repl] [clojure.main] [clojure.tools.nrepl :only [version]] + [compliment.core :only [all-files]] [trptcolin.versioneer.core :as version])) (def prelude @@ -143,30 +144,29 @@ ((ns-resolve (symbol "cd-client.core") (symbol "pr-examples-core")) ~ns-str ~var-str)))) -(defn formify-file [f] - (read-string (str "(do " (slurp f) ")"))) +(defn formify-files [files] + (read-string (str "(do " (apply str (map slurp files)) ")"))) + +(defn compliment-files [] + (map #(-> (Thread/currentThread) + (.getContextClassLoader) + (.getResource %)) + compliment.core/all-files)) (defn completion-code [] `(try - (require '[complete.core]) - ; hack for 1.2 support until we release the next clojure-complete version - ~(export-definition 'reply.initialization/resolve-class) - (~'reply.exports/intern-with-meta - '~'complete.core '~'resolve-class ~'#'resolve-class) + (require '[compliment.core]) (catch Exception e# (try (eval '~(try - (formify-file - (-> (Thread/currentThread) - (.getContextClassLoader) - (.getResource "complete/core.clj"))) + (formify-files (compliment-files)) (catch Exception e - '(throw (Exception. "Couldn't find complete/core.clj"))))) + '(throw (Exception. "Couldn't find compliment/core.clj"))))) (catch Exception f# - (intern (create-ns '~'complete.core) '~'completions - (fn [prefix# ns#] [])) + (intern (create-ns '~'compliment.core) '~'completions + (fn [prefix# ns# context#] [])) (println "Unable to initialize completions.")))))) (defn default-init-code [{:keys [custom-help] :as options}] @@ -228,4 +228,3 @@ ~(when custom-eval custom-eval) ~(when custom-init custom-init) nil)) - diff --git a/src/clj/reply/main.clj b/src/clj/reply/main.clj index 298b525..c43d9ff 100644 --- a/src/clj/reply/main.clj +++ b/src/clj/reply/main.clj @@ -22,8 +22,8 @@ "[experimental] Provide an error handler function (0-1 arguments)." :parse-fn read-string] ["-i" "--init" "--custom-init" - "Provide a Clojure file to evaluate in the user ns" - :parse-fn initialization/formify-file] + "Provide Clojure files to evaluate in the user ns" + :parse-fn initialization/formify-files] ["--standalone" "Launch standalone mode instead of the default nREPL" :flag true] ["--color" "Use color" diff --git a/src/clj/reply/reader/jline/completion.clj b/src/clj/reply/reader/jline/completion.clj index fe525dd..a29cf67 100644 --- a/src/clj/reply/reader/jline/completion.clj +++ b/src/clj/reply/reader/jline/completion.clj @@ -1,10 +1,10 @@ (ns reply.reader.jline.completion (:require [reply.completion :as completion] - [complete.core]) + [compliment.core]) (:import [jline.console.completer Completer])) (defn construct-possible-completions-form [prefix ns] - `(~'complete.core/completions (~'str ~prefix) (~'symbol ~ns))) + `(~'compliment.core/completions (~'str ~prefix) (~'symbol ~ns) nil)) (defn get-prefix [buffer cursor] (let [buffer (or buffer "")]