branch: externals/dape
commit 7056a81510c2957d9714bf092c142d6e49a9ff44
Author: Daniel Pettersson <dan...@dpettersson.net>
Commit: Daniel Pettersson <dan...@dpettersson.net>

    Handle connections of depth >= 2 #101
    
    Did not foresee that child connections could have child connections
    in turn.
    
    An better solution might be to append startDebugging connection to
    "main" connection to ensure the validity of 'last for
    `dape--live-connection'.
---
 dape.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/dape.el b/dape.el
index a2579a6096..f2784e63f5 100644
--- a/dape.el
+++ b/dape.el
@@ -1175,10 +1175,16 @@ See `dape--connection-selected'."
 
 (defun dape--live-connections ()
   "Get all live connections."
-  (when (and dape--connection (jsonrpc-running-p dape--connection))
-    (cons dape--connection
-          (seq-filter 'jsonrpc-running-p
-                      (reverse (dape--children dape--connection))))))
+  (cl-labels ((live-connections-1 (conn)
+                (when (and conn (jsonrpc-running-p conn))
+                  (cons conn
+                        (mapcan #'live-connections-1
+                                ;; New children are `push'ed onto the
+                                ;; children list, therefore children
+                                ;; are `reverse'd to guarantee LIFO
+                                ;; order.
+                                (reverse (dape--children conn)))))))
+    (live-connections-1 dape--connection)))
 
 (defclass dape-connection (jsonrpc-process-connection)
   ((last-id

Reply via email to