Skip to content

Commit a211955

Browse files
committed
Ignore mlmodel files when creating Filespace
1 parent 3e230e4 commit a211955

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Core/Sources/Service/Workspace.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ final class Workspace {
129129
"Suggestion feature is disabled for this project."
130130
}
131131
}
132+
133+
struct UnsupportedFileError: Error, LocalizedError {
134+
var extensionName: String
135+
var errorDescription: String? {
136+
"File type \(extensionName) unsupported."
137+
}
138+
}
132139

133140
let projectRootURL: URL
134141
let openedFileRecoverableStorage: OpenedFileRecoverableStorage
@@ -223,6 +230,11 @@ final class Workspace {
223230
static func fetchOrCreateWorkspaceIfNeeded(fileURL: URL) async throws
224231
-> (workspace: Workspace, filespace: Filespace)
225232
{
233+
let ignoreFileExtensions = ["mlmodel"]
234+
if ignoreFileExtensions.contains(fileURL.pathExtension) {
235+
throw UnsupportedFileError(extensionName: fileURL.pathExtension)
236+
}
237+
226238
// If we know which project is opened.
227239
if let currentProjectURL = try await Environment.fetchCurrentProjectRootURLFromXcode() {
228240
if let existed = workspaces[currentProjectURL] {

0 commit comments

Comments
 (0)