clojure-emacs / ac-nrepl

[DEPRECATED] Emacs auto-complete backend for nrepl completions
74 stars 11 forks source link

Error when completing string starting with a "/" character. #6

Closed hrathod closed 12 years ago

hrathod commented 12 years ago

An exception is thrown in the REPL, when completing a string that begins with a "/" character.

; nREPL 0.1.3                                                                                   
user> (println "/t")

results in the following exception after waiting for auto-completion pop-up:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt (String.java:686) clojure.lang.Compiler.maybeResolveIn (Compiler.java:6786) clojure.core$ns_resolve.invoke (core.clj:3883) clojure.core$ns_resolve.invoke (core.clj:3880) clojure.core$resolve.invoke (core.clj:3889) complete.core$resolve_class.invoke (core.clj:83) complete.core$eval670$fn671.invoke (core.clj:100) clojure.lang.MultiFn.invoke (MultiFn.java:167) complete.core$completions.invoke (core.clj:124) user$eval713.invoke (NO_SOURCE_FILE:1) clojure.lang.Compiler.eval (Compiler.java:6511) clojure.lang.Compiler.eval (Compiler.java:6477) clojure.core$eval.invoke (core.clj:2797) clojure.main$repl$read_eval_print6405.invoke (main.clj:245) clojure.main$repl$fn6410.invoke (main.clj:266) clojure.main$repl.doInvoke (main.clj:266) clojure.lang.RestFn.invoke (RestFn.java:1096) clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn337.invoke (interruptible_eval.clj:51) clojure.lang.AFn.applyToHelper (AFn.java:159) clojure.lang.AFn.applyTo (AFn.java:151) clojure.core$apply.invoke (core.clj:601) clojure.core$with_bindingsSTAR.doInvoke (core.clj:1771) clojure.lang.RestFn.invoke (RestFn.java:425) clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:36) clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn374$fn__376.invoke (interruptible_eval.clj:162) clojure.core$comp$fn4034.invoke (core.clj:2278) clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__367.invoke (interruptible_eval.clj:129) clojure.lang.AFn.run (AFn.java:24) java.util.concurrent.ThreadPoolExecutor$Worker.runTask (ThreadPoolExecutor.java:886) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908) java.lang.Thread.run (Thread.java:662)

purcell commented 12 years ago

Thanks - fixed! Like in nrepl.el itself, the solution is to not allow completion when the point is inside a string.

-Steve