@@ -140,9 +140,11 @@ public final class XcodeInspector: ObservableObject {
140140 latestNonRootWorkspaceURL = nil
141141 }
142142
143+ // finds running Xcode instances
143144 let runningApplications = NSWorkspace . shared. runningApplications
144145 xcodes = runningApplications
145146 . filter { $0. isXcode }
147+ // creates a XcodeAppInstanceInspector for each Xcode instance
146148 . map ( XcodeAppInstanceInspector . init ( runningApplication: ) )
147149 let activeXcode = xcodes. first ( where: \. isActive)
148150 latestActiveXcode = activeXcode ?? xcodes. first
@@ -160,6 +162,7 @@ public final class XcodeInspector: ObservableObject {
160162 }
161163
162164 await withThrowingTaskGroup ( of: Void . self) { [ weak self] group in
165+ // activation
163166 group. addTask { [ weak self] in // Did activate app
164167 let sequence = NSWorkspace . shared. notificationCenter
165168 . notifications ( named: NSWorkspace . didActivateApplicationNotification)
@@ -193,6 +196,7 @@ public final class XcodeInspector: ObservableObject {
193196 }
194197 }
195198
199+ // termination
196200 group. addTask { [ weak self] in // Did terminate app
197201 let sequence = NSWorkspace . shared. notificationCenter
198202 . notifications ( named: NSWorkspace . didTerminateApplicationNotification)
@@ -242,6 +246,7 @@ public final class XcodeInspector: ObservableObject {
242246 }
243247 }
244248
249+ // accessibility API issues
245250 group. addTask { [ weak self] in // malfunctioning
246251 let sequence = NotificationCenter . default
247252 . notifications ( named: . accessibilityAPIMalfunctioning)
@@ -267,6 +272,10 @@ public final class XcodeInspector: ObservableObject {
267272 }
268273 }
269274
275+ // Get the focused UI element
276+ // Determine if it's a source editor
277+ // Monitor for focus changes
278+
270279 @XcodeInspectorActor
271280 private func setActiveXcode( _ xcode: XcodeAppInstanceInspector ) {
272281 previousActiveApplication = activeApplication
@@ -279,9 +288,12 @@ public final class XcodeInspector: ObservableObject {
279288
280289 activeXcode = xcode
281290 latestActiveXcode = xcode
291+ // active document
282292 activeDocumentURL = xcode. documentURL
293+ // focused window
283294 focusedWindow = xcode. focusedWindow
284295 completionPanel = xcode. completionPanel
296+ // project root
285297 activeProjectRootURL = xcode. projectRootURL
286298 activeWorkspaceURL = xcode. workspaceURL
287299 focusedWindow = xcode. focusedWindow
@@ -304,6 +316,7 @@ public final class XcodeInspector: ObservableObject {
304316 }
305317
306318 focusedElement = getFocusedElementAndRecordStatus ( xcode. appElement)
319+ // focused editor
307320 if let editorElement = focusedElement, editorElement. isSourceEditor {
308321 focusedEditor = . init(
309322 runningApplication: xcode. runningApplication,
0 commit comments