Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #17 from ninjudd/handle_empty_slash

Handle slash without anything before it
  • Loading branch information...
commit 76d4bda4ace2e3a0d5c990cb7bbfd037a6add76c 2 parents e106888 + cb31512
@ninjudd authored
Showing with 11 additions and 6 deletions.
  1. +7 −6 src/complete/core.clj
  2. +4 −0 test/complete/core_test.clj
View
13 src/complete/core.clj
@@ -95,12 +95,13 @@
(defmethod potential-completions :scoped
[prefix ns]
- (let [scope (symbol (first (.split prefix "/")))]
- (map #(str scope "/" %)
- (if-let [class (resolve-class scope)]
- (static-members class)
- (when-let [ns (or (find-ns scope) (scope (ns-aliases ns)))]
- (ns-public-vars ns))))))
+ (when-let [prefix-scope (first (.split prefix "/"))]
+ (let [scope (symbol prefix-scope)]
+ (map #(str scope "/" %)
+ (if-let [class (resolve-class scope)]
+ (static-members class)
+ (when-let [ns (or (find-ns scope) (scope (ns-aliases ns)))]
+ (ns-public-vars ns)))))))
(defmethod potential-completions :class
[prefix ns]
View
4 test/complete/core_test.clj
@@ -20,6 +20,10 @@
(is (= '("java.lang.System/out")
(completions "java.lang.System/out")))
+ (is (= () (completions "fake-ns-here/")))
+
+ (is (= () (completions "/")))
+
(is (some #{"String/valueOf"} (completions "String/")))
(is (not (some #{"String/indexOf" ".indexOf"} (completions "String/")))))
Please sign in to comment.
Something went wrong with that request. Please try again.