public sealed class RecentDocumentsThe documents most recently opened or saved, by where they live, newest first.
Remarks
Keyed on Location and on nothing else (#656). A document that has never been saved has no location and is not recent in any sense a menu can reopen; one that is saved under a new name is the new name, which is why Track follows the signal rather than reading it once.
⚠ A location is compared as written, ordinally. Whether two spellings of a path are one file is the platform's question and the host's — the editor hands this absolute paths from one function — and a list that guessed would merge two files on a case-sensitive volume.
⚠ Forgetting is explicit, never a side-effect of a file being missing. A path on a volume that is not mounted is the entry somebody most wants back, so a host greys it and keeps it — the rule the editor's recent-projects list already follows.
It holds strings, not documents, so it is what a host saves and restores between runs — Restore takes the list back without the reordering Note does.
Fields and properties (2)
public int CapacityHow many it keeps.
public IReadOnlyList<string> LocationsThe locations, newest first.
Events (1)
public Action<RecentDocuments>? ChangedRaised after the list changed, and not when a note changed nothing.
Methods (5)
public RecentDocuments(int capacity = 10)An empty list.
public bool Note(string location)Puts a location at the front, once.
public bool Forget(string location)Takes a location off the list.
public void Restore(IEnumerable<string> saved)Replaces the list with one a host kept, in its order, without duplicates and within the capacity.
public IDisposable Track(IEditableDocument document, EffectScheduler? scheduler = null)Notes a document's location now and every time it changes to another.
Used by (5)
- RecentDocumentsTestsVixen.Ui.Tests
- EditorWorkspaceVixen.Editor.Ui
- IWorkspaceVixen.Editor.Ui
- RecentDocumentsMenuTestsVixen.Editor.App.Tests
- WorkspaceModuleVixen.Editor.App