Skip to content

Commit 6753da1

Browse files
committed
Never creates duplicated workspaces
1 parent 4cf3cc7 commit 6753da1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Core/Sources/Service/Workspace.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ final class Workspace {
8989
static func fetchOrCreateWorkspaceIfNeeded(fileURL: URL) async throws
9090
-> (workspace: Workspace, filespace: Filespace)
9191
{
92+
// never create duplicated filespaces
93+
for workspace in workspaces.values {
94+
if let filespace = workspace.filespaces[fileURL] {
95+
return (workspace, filespace)
96+
}
97+
}
98+
9299
let projectURL = try await Environment.fetchCurrentProjectRootURL(fileURL)
93100
let workspaceURL = projectURL ?? fileURL
94101
let workspace = workspaces[workspaceURL] ?? Workspace(projectRootURL: workspaceURL)

0 commit comments

Comments
 (0)