From 190161a5dc0d2219b631100cfef93903760948a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Nuno=20Monteiro?= Date: Fri, 11 May 2018 11:23:32 -0700 Subject: [PATCH] Fix crash when trying to auto-complete line that ends with quote (#399) fixes #365 --- CHANGELOG.md | 1 + build.boot | 1 + src/cljs/snapshot/lumo/repl.cljs | 2 +- src/test/lumo/lumo/repl_tests.cljs | 5 ++++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aed8cf12..20a57872 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - `clojure.reflect` not bundled ([#369](https://github.com/anmonteiro/lumo/issues/369)). - `-e` with unfinished form hangs ([#375](https://github.com/anmonteiro/lumo/issues/375)). +- Fix crash when trying to auto-complete a line ending with `'` ([#365](https://github.com/anmonteiro/lumo/issues/365)). ### Changes diff --git a/build.boot b/build.boot index 6bb1c12e..9fc9931a 100644 --- a/build.boot +++ b/build.boot @@ -57,6 +57,7 @@ :cljs-opts {:parallel-build true :target :nodejs :verbose true + :npm-deps false :asset-path "test_suite.out"} :update-fs? true :exit? exit? diff --git a/src/cljs/snapshot/lumo/repl.cljs b/src/cljs/snapshot/lumo/repl.cljs index e1945ab4..7e7a2ed4 100644 --- a/src/cljs/snapshot/lumo/repl.cljs +++ b/src/cljs/snapshot/lumo/repl.cljs @@ -1424,7 +1424,7 @@ This was taken from the reader specification plus tests at the Clojure REPL."} #js [] (if skip-suffix-check? (completion-candidates top-level? ns-alias) - (filter #(is-completion? line-match-suffix %) + (filter #(some-> line-match-suffix (is-completion? %)) (completion-candidates top-level? ns-alias))))] (cb (doto completions .sort))))) diff --git a/src/test/lumo/lumo/repl_tests.cljs b/src/test/lumo/lumo/repl_tests.cljs index 54c39eb0..3006744a 100644 --- a/src/test/lumo/lumo/repl_tests.cljs +++ b/src/test/lumo/lumo/repl_tests.cljs @@ -148,7 +148,10 @@ (is-completion "foo-1.core/" ["foo-1.core/baz-3" "foo-1.core/bar2" "foo-1.core/xyz"]) (is-completion "foo-1.core/ba" ["foo-1.core/baz-3" "foo-1.core/bar2"]))) (testing "LUMO-362" - (is-contains-completion "(+" "(+")))) + (is-contains-completion "(+" "(+")) + (testing "LUMO-365" + (is-empty-completion "(require '") + (is-empty-completion "'")))) (deftest test-root-resource