Skip to content

Commit

Permalink
Added aliases to completions! :O
Browse files Browse the repository at this point in the history
  • Loading branch information
Olical committed Jan 11, 2019
1 parent 76baf8d commit b28bdf7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/clojure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,21 @@ pub fn completions(ns: &str, core_ns: &str) -> String {
// Symbols of those namespaces prefixed by your aliases
format!(
"#?(:clj (let [nss (map (comp symbol str) (all-ns))
ns-syms (->> (map (comp vals ns-publics) nss) (apply concat) (map symbol))]
ns-syms (->> (map (comp vals ns-publics) nss) (apply concat) (map symbol))
ns-alias-syms (->> (map (fn [a]
(map #(symbol (str (key a)) (name (symbol %)))
(vals (ns-publics (-> (val a) str symbol)))))
(ns-aliases '{}))
(apply concat))]
(-> (keys (ns-map '{}))
(concat nss ns-syms)
(dedupe)
(concat nss ns-syms ns-alias-syms)
(distinct)
(sort)))
:cljs (-> (keys (ns-interns '{}))
(concat (keys (ns-publics '{})))
(dedupe)
(distinct)
(sort)))",
ns, ns, core_ns
ns, ns, ns, core_ns
)
}

Expand Down

0 comments on commit b28bdf7

Please sign in to comment.