Skip to content

Commit

Permalink
nrepl: order session tags, current session should go first
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin committed Sep 28, 2016
1 parent 7254c52 commit 5fd913e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/nrepl/dirac/nrepl/sessions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@
(defn get-dirac-session-tag [session]
(prepare-dirac-session-descriptor-tag (find-dirac-session-descriptor session)))

(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)))
([] (get-other-sessions-descriptors (state/get-current-session-if-avail)))
([session]
(assert session)
(remove #(= session (get-dirac-session-descriptor-session %)) @state/session-descriptors)))

(defn get-dirac-session-tags []
(let [current-session-descriptor (find-dirac-session-descriptor (state/get-current-session-if-avail))
other-descriptors (get-other-sessions-descriptors)
ordered-descriptors (keep identity (concat [current-session-descriptor] other-descriptors))]
(get-dirac-session-descriptors-tags ordered-descriptors)))

; -- joining sessions -------------------------------------------------------------------------------------------------------

(defn make-joined-session-descriptor [matcher-fn info]
Expand Down
3 changes: 3 additions & 0 deletions src/nrepl/dirac/nrepl/state.clj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
(assert *current-session*)
*current-session*)

(defn get-current-session-if-avail []
*current-session*)

(defn get-session-binding-value
([var] (get-session-binding-value *current-session* var))
([session var]
Expand Down

0 comments on commit 5fd913e

Please sign in to comment.