Skip to content

Commit 10e7ad3

Browse files
committed
Fix a but that fetches incorrect filespace
1 parent 134506a commit 10e7ad3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Tool/Sources/Workspace/WorkspacePool.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ public class WorkspacePool {
6161
}
6262

6363
public func fetchFilespaceIfExisted(fileURL: URL) -> Filespace? {
64+
// We prefer to get the filespace from the current active workspace.
65+
// Just incase there are multiple workspaces opened with the same file.
66+
if let currentWorkspaceURL = XcodeInspector.shared.realtimeActiveWorkspaceURL {
67+
if let workspace = workspaces[currentWorkspaceURL],
68+
let filespace = workspace.filespaces[fileURL]
69+
{
70+
return filespace
71+
}
72+
}
6473
for workspace in workspaces.values {
6574
if let filespace = workspace.filespaces[fileURL] {
6675
return filespace

0 commit comments

Comments
 (0)