@@ -24,7 +24,7 @@ public final class XcodeInspector: ObservableObject {
2424 @Published public internal( set) var focusedEditor : SourceEditor ?
2525 @Published public internal( set) var focusedElement : AXUIElement ?
2626 @Published public internal( set) var completionPanel : AXUIElement ?
27-
27+
2828 public var focusedEditorContent : EditorInformation ? {
2929 guard let documentURL = XcodeInspector . shared. realtimeActiveDocumentURL,
3030 let workspaceURL = XcodeInspector . shared. realtimeActiveWorkspaceURL,
@@ -253,11 +253,9 @@ public final class XcodeAppInstanceInspector: AppInstanceInspector {
253253 }
254254
255255 public var realtimeProjectURL : URL ? {
256- guard let window = appElement. focusedWindow else { return nil }
257256 let workspaceURL = realtimeWorkspaceURL
258257 let documentURL = realtimeDocumentURL
259258 return WorkspaceXcodeWindowInspector . extractProjectURL (
260- windowElement: window,
261259 workspaceURL: workspaceURL,
262260 documentURL: documentURL
263261 )
@@ -469,18 +467,8 @@ extension XcodeAppInstanceInspector {
469467
470468 /// Use the project path as the workspace identifier.
471469 static func workspaceIdentifier( _ window: AXUIElement ) -> WorkspaceIdentifier {
472- for child in window. children {
473- if child. description. starts ( with: " / " ) , child. description. count > 1 {
474- let path = child. description
475- let trimmedNewLine = path. trimmingCharacters ( in: . newlines)
476- var url = URL ( fileURLWithPath: trimmedNewLine)
477- while !FileManager. default. fileIsDirectory ( atPath: url. path) ||
478- !url. pathExtension. isEmpty
479- {
480- url = url. deletingLastPathComponent ( )
481- }
482- return WorkspaceIdentifier . url ( url)
483- }
470+ if let url = WorkspaceXcodeWindowInspector . extractWorkspaceURL ( windowElement: window) {
471+ return WorkspaceIdentifier . url ( url)
484472 }
485473 return WorkspaceIdentifier . unknown
486474 }
0 commit comments