From d9e1f87ea4fd5aad330ec209aefe9ff20f3a10ef Mon Sep 17 00:00:00 2001 From: Antonin Hildebrand Date: Wed, 28 Sep 2016 20:01:07 +0200 Subject: [PATCH] nrepl: when listing compilers put current session compilers first --- src/nrepl/dirac/nrepl/compilers.clj | 5 +++-- src/nrepl/dirac/nrepl/sessions.clj | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/nrepl/dirac/nrepl/compilers.clj b/src/nrepl/dirac/nrepl/compilers.clj index 35af80fbde..662256b923 100644 --- a/src/nrepl/dirac/nrepl/compilers.clj +++ b/src/nrepl/dirac/nrepl/compilers.clj @@ -53,9 +53,10 @@ ; -- all compilers in the process ------------------------------------------------------------------------------------------- (defn collect-all-available-compiler-descriptors [] - (let [dirac-compilers (mapcat extract-session-compiler-descriptors @state/session-descriptors) + (let [session-compilers (state/get-session-compiler-descriptors) + other-sessions-compilers (mapcat extract-session-compiler-descriptors (sessions/get-other-sessions-descriptors)) figwheel-compilers (figwheel/collect-available-compiler-descriptors)] - (concat figwheel-compilers dirac-compilers))) + (concat session-compilers other-sessions-compilers figwheel-compilers))) ; order is important here, we are matching compilers in this order (defn compiler-descriptors-ids [descriptors] (vec (map get-compiler-descriptor-id descriptors))) diff --git a/src/nrepl/dirac/nrepl/sessions.clj b/src/nrepl/dirac/nrepl/sessions.clj index 63cbc563f9..234d325ce9 100644 --- a/src/nrepl/dirac/nrepl/sessions.clj +++ b/src/nrepl/dirac/nrepl/sessions.clj @@ -82,6 +82,12 @@ (defn get-dirac-session-tags [] (get-dirac-session-descriptors-tags @state/session-descriptors)) +(defn get-other-sessions-descriptors + ([] (get-other-sessions-descriptors (state/get-current-session))) + ([session] + (assert session) + (remove #(= session (get-dirac-session-descriptor-session %)) @state/session-descriptors))) + ; -- joining sessions ------------------------------------------------------------------------------------------------------- (defn make-joined-session-descriptor [matcher-fn info]