Skip to content

Commit

Permalink
Fix #190: null namespace in completions
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed May 14, 2022
1 parent c6f7da9 commit 5476631
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/nbb/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@

(def normalize-libname
{'clojure.pprint 'cljs.pprint
'clojure.test 'cljs.test})
'clojure.test 'cljs.test
'clojure.math 'cljs.math})

(def sci-find-ns (delay (sci/eval-form @sci-ctx 'find-ns)))

Expand All @@ -68,12 +69,12 @@
(esm/dynamic-import m))
(.then (fn [_module]
(let [nlib (normalize-libname libname)]
(when-not (= nlib libname)
(when as
(sci/eval-form @sci-ctx
(list 'alias
(list 'quote libname)
(list 'quote nlib)))))
(when (and as nlib
(not= nlib libname))
(sci/eval-form @sci-ctx
(list 'alias
(list 'quote libname)
(list 'quote nlib))))
(let [libname (or nlib libname)]
(when as
(sci/eval-form @sci-ctx
Expand Down
2 changes: 1 addition & 1 deletion src/nbb/impl/repl_utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[sci.core :as sci]))

(defn the-sci-ns [ctx ns-sym]
(sci/eval-form ctx (list 'clojure.core/the-ns (list 'quote ns-sym))))
(sci/find-ns ctx ns-sym))

(defn format [fmt-str x]
(str/replace fmt-str "%s" x))
Expand Down

0 comments on commit 5476631

Please sign in to comment.