File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -93,11 +93,6 @@ final class CodeEditDocumentController: NSDocumentController {
9393 }
9494 }
9595
96- override func clearRecentDocuments( _ sender: Any ? ) {
97- super. clearRecentDocuments ( sender)
98- UserDefaults . standard. set ( [ Any] ( ) , forKey: " recentProjectPaths " )
99- }
100-
10196 override func addDocument( _ document: NSDocument ) {
10297 super. addDocument ( document)
10398 if let document = document as? CodeFileDocument {
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ enum RecentProjectsStore {
4040
4141 // Limit list to to 100 items after de-duplication
4242 UserDefaults . standard. setValue ( Array ( paths. prefix ( 100 ) ) , forKey: defaultsKey)
43+ setDocumentControllerRecents ( )
4344 donateSearchableItems ( )
4445 NotificationCenter . default. post ( name: Self . didUpdateNotification, object: nil )
4546 }
@@ -72,6 +73,15 @@ enum RecentProjectsStore {
7273 setPaths ( [ ] )
7374 }
7475
76+ /// Syncs AppKit's recent documents list with ours, keeping the dock menu and other lists up-to-date.
77+ private static func setDocumentControllerRecents( ) {
78+ CodeEditDocumentController . shared. clearRecentDocuments ( nil )
79+ for path in recentProjectURLs ( ) . prefix ( 10 ) {
80+ CodeEditDocumentController . shared. noteNewRecentDocumentURL ( path)
81+ }
82+ }
83+
84+ /// Donates all recent URLs to Core Search, making them searchable in Spotlight
7585 private static func donateSearchableItems( ) {
7686 let searchableItems = recentProjectURLs ( ) . map { entity in
7787 let attributeSet = CSSearchableItemAttributeSet ( contentType: . content)
You can’t perform that action at this time.
0 commit comments