@@ -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] {
@@ -401,6 +413,13 @@ extension Workspace {
401413 refreshUpdateTime ( )
402414 openedFileRecoverableStorage. openFile ( fileURL: filespace. fileURL)
403415 Task {
416+ // check if file size is larger than 15MB, if so, return immediately
417+ if let attrs = try ? FileManager . default
418+ . attributesOfItem ( atPath: filespace. fileURL. path) ,
419+ let fileSize = attrs [ FileAttributeKey . size] as? UInt64 ,
420+ fileSize > 15 * 1024 * 1024
421+ { return }
422+
404423 try await suggestionService? . notifyOpenTextDocument (
405424 fileURL: filespace. fileURL,
406425 content: try String ( contentsOf: filespace. fileURL, encoding: . utf8)
0 commit comments