@@ -423,9 +423,6 @@ private func isCompletionPanel(_ element: AXUIElement) -> Bool {
423423
424424public extension AXUIElement {
425425 var tabBars : [ AXUIElement ] {
426- // Searching by traversing with AXUIElement is (Xcode) resource consuming, we should skip
427- // as much as possible!
428-
429426 guard let editArea: AXUIElement = {
430427 if description == " editor area " { return self }
431428 return firstChild ( where: { $0. description == " editor area " } )
@@ -471,4 +468,44 @@ public extension AXUIElement {
471468
472469 return tabBars
473470 }
471+
472+ var debugArea : AXUIElement ? {
473+ guard let editArea: AXUIElement = {
474+ if description == " editor area " { return self }
475+ return firstChild ( where: { $0. description == " editor area " } )
476+ } ( ) else { return nil }
477+
478+ var debugArea : AXUIElement ?
479+ editArea. traverse { element, _ in
480+ let description = element. description
481+ if description == " Tab Bar " {
482+ return . skipDescendants
483+ }
484+
485+ if element. identifier == " editor context " {
486+ return . skipDescendantsAndSiblings
487+ }
488+
489+ if element. isSourceEditor {
490+ return . skipDescendantsAndSiblings
491+ }
492+
493+ if description == " Code Coverage Ribbon " {
494+ return . skipDescendants
495+ }
496+
497+ if description == " Debug Area " {
498+ debugArea = element
499+ return . skipDescendants
500+ }
501+
502+ if description == " debug bar " {
503+ return . skipDescendants
504+ }
505+
506+ return . continueSearching
507+ }
508+
509+ return debugArea
510+ }
474511}
0 commit comments