Skip to content
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ issue](https://github.com/trptcolin/reply/issues), but the following may help.
For keybinding issues, check out `~/.inputrc` - you can mostly use the same
specifications there as you can with normal readline applications like bash,
but from time to time we do come across missing features that we then add to
[jline](https://github.com/jline/jline2).
[jline](https://github.com/jline/jline3).

To get a very detailed look at what jline is doing under the hood, you can
`export JLINE_LOGGING=trace` (or `debug`) before starting REPLy. There may be
Expand All @@ -93,7 +93,7 @@ me know if you are!
## Thanks

Thanks to the developers of [Clojure](https://github.com/clojure/clojure),
[JLine](https://github.com/jline/jline2), [nREPL](https://github.com/nrepl/nrepl),
[JLine](https://github.com/jline/jline3), [nREPL](https://github.com/nrepl/nrepl),
[incomplete](https://github.com/nrepl/incomplete),
for their work on the excellent projects that this project depends upon.

Expand Down
3 changes: 1 addition & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(defproject reply "0.6.0-SNAPSHOT"
:description "REPL-y: A fitter, happier, more productive REPL for Clojure."
:dependencies [[org.clojure/clojure "1.8.0"]
[jline "2.14.6"]
[org.jline/jline "3.28.0"]
[clj-stacktrace "0.2.8"]
[nrepl "1.5.2"]
[org.clojure/tools.cli "1.3.250"]
Expand All @@ -25,7 +25,6 @@
:1.10 {:dependencies [[org.clojure/clojure "1.10.3"]]}
:1.11 {:dependencies [[org.clojure/clojure "1.11.4"]]}
:1.12 {:dependencies [[org.clojure/clojure "1.12.4"]]}}
;; :jvm-opts ["-Djline.internal.Log.trace=true"]
:aot [reply.reader.jline.JlineInputReader]
:main ^{:skip-aot true} reply.main
:deploy-repositories [["clojars" {:url "https://clojars.org/repo"
Expand Down
53 changes: 0 additions & 53 deletions spec/reply/reader/jline/completion_spec.clj

This file was deleted.

47 changes: 0 additions & 47 deletions spec/reply/reader/jline/jline_input_reader_spec.clj

This file was deleted.

26 changes: 11 additions & 15 deletions src/reply/reader/jline/completion.clj
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
(ns reply.reader.jline.completion
(:require [reply.completion :as completion]
[incomplete.core])
(:import [jline.console.completer Completer]))
(:import [org.jline.reader Completer Candidate ParsedLine LineReader]))

(defn construct-possible-completions-form [prefix ns]
`(~'incomplete.core/completions (~'str ~prefix) (~'symbol ~ns)))

(defn get-prefix [buffer cursor]
(let [buffer (or buffer "")]
(or (completion/get-word-ending-at buffer cursor) "")))
(defn get-prefix [^ParsedLine line]
(let [word (.word line)]
(or word "")))

(defn make-completer [eval-fn redraw-line-fn ns]
(defn make-completer [eval-fn ns]
(proxy [Completer] []
(complete [^String buffer cursor ^java.util.List candidates]
(let [prefix ^String (get-prefix buffer cursor)
(complete [^LineReader reader ^ParsedLine line ^java.util.List candidates]
(let [prefix ^String (get-prefix line)
prefix-length (.length prefix)]
(if (zero? prefix-length)
-1
(when-not (zero? prefix-length)
(let [possible-completions-form (construct-possible-completions-form
prefix ns)
possible-completions (eval-fn possible-completions-form)]
(if (empty? possible-completions)
-1
(do
(.addAll candidates (map :candidate possible-completions))
(redraw-line-fn)
(- cursor prefix-length)))))))))
(when-not (empty? possible-completions)
(doseq [c possible-completions]
(.add candidates (Candidate. (:candidate c)))))))))))
Loading