-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
namespace.clj
28 lines (24 loc) · 809 Bytes
/
namespace.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(ns iced.nrepl.namespace
(:require [clojure.string :as str]
[iced.util.namespace :as i.u.ns]
[medley.core :as medley]
[orchard.namespace :as o.ns]
[refactor-nrepl.ns.ns-parser :as r.ns.parser]))
(defn- ensure-string-map [m]
(medley/map-kv (fn [k v] [(str k) (str v)]) m))
(defmulti aliases (fn [env _] env))
(defmethod aliases "clj"
[_ ns-code]
(or (some->> ns-code i.u.ns/extract-ns-sym ns-aliases
(medley/map-vals ns-name)
ensure-string-map)
{}))
(defmethod aliases "cljs"
[_ ns-code]
(or (when (seq ns-code)
(some-> ns-code read-string r.ns.parser/get-libspecs
r.ns.parser/aliases
ensure-string-map))
{}))
(defn project-ns-list []
(o.ns/project-namespaces))