Skip to content

Commit

Permalink
Disable file monitoring thebaselab#722
Browse files Browse the repository at this point in the history
  • Loading branch information
bummoblizard committed Jan 27, 2023
1 parent 5a405c0 commit 3d32a7b
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions CodeApp/Types/EditorInstance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,26 @@ class TextEditorInstance: EditorInstanceWithURL {
self.lastSavedDate = lastSavedDate
super.init(view: AnyView(editor), title: url.lastPathComponent, url: url)

self.fileWatch?.folderDidChange = { [weak self] lastModified in
guard let self = self else { return }
// Disable this until #722 is fixed.

// self.fileWatch?.folderDidChange = { [weak self] lastModified in
// guard let self = self else { return }

guard let content = try? String(contentsOf: url, encoding: self.encoding) else {
return
}
// guard let content = try? String(contentsOf: url, encoding: self.encoding) else {
// return
// }

DispatchQueue.main.async {
if !self.isSaving, self.isSaved,
lastModified > self.lastSavedDate ?? Date.distantFuture
{
self.content = content
self.lastSavedDate = lastModified
fileDidChange?(.modified, content)
}
}
}
self.fileWatch?.startMonitoring()
// DispatchQueue.main.async {
// if !self.isSaving, self.isSaved,
// lastModified > self.lastSavedDate ?? Date.distantFuture
// {
// self.content = content
// self.lastSavedDate = lastModified
// fileDidChange?(.modified, content)
// }
// }
// }
// self.fileWatch?.startMonitoring()
}
}

Expand Down

0 comments on commit 3d32a7b

Please sign in to comment.