before the great git rework

This commit is contained in:
2026-10-30 11:27:44 +01:00
parent 9bdda896af
commit b9c03a7637
45 changed files with 70 additions and 562 deletions
@@ -17,11 +17,10 @@ extension WorkspaceModel {
isReady = true
}
/// Asks about every unsaved file, then writes the note and the session.
/// Asks about every unsaved file, then writes the session.
/// False when the user cancelled: the window or project must stay.
public func prepareToClose() async -> Bool {
if let editor, !(await editor.resolveUnsaved()) { return false }
await note?.save()
await editor?.persist()
return true
}
@@ -66,9 +65,6 @@ extension WorkspaceModel {
wire(editor, symbols: services.symbols)
self.editor = editor
let note = NoteStore(notes: services.notes)
note.notify = notify
self.note = note
cleanCopy = CleanCopyStore(files: services.files)
terminal = TerminalStore(projectRoot: root.path)
wireTerminal()
@@ -101,12 +97,11 @@ extension WorkspaceModel {
recentProjects = await app.recentProjects.list()
guard generation == current else { return }
launcher = LauncherList(recents: recentProjects, excluding: root.path)
let sourceControl = sourceControl, explorer = explorer, note = note, editor = editor, cleanCopy = cleanCopy
let sourceControl = sourceControl, explorer = explorer, editor = editor, cleanCopy = cleanCopy
async let git: Void = sourceControl?.refresh() ?? ()
async let tree: Void = explorer?.reload() ?? ()
async let loaded: Void = note?.load() ?? ()
async let baseline: Void = cleanCopy?.loadBaseline() ?? ()
_ = await (git, tree, loaded, baseline)
_ = await (git, tree, baseline)
await editor?.restore(restoreSession: config.session.restoreOnLaunch)
guard generation == current else { return }
startWatcher(root)
@@ -115,7 +110,7 @@ extension WorkspaceModel {
}
/// Stops the watchers and polling, waits for the work still running against this project,
/// then stops reading aloud, saves the note and the session and ends the terminals.
/// then stops reading aloud, saves the session and ends the terminals.
func closeProject() async {
watcher?.stop()
watcher = nil
@@ -134,7 +129,6 @@ extension WorkspaceModel {
for task in running { await task.value }
readAloud.stop()
await editor?.flushAutoSaves()
await note?.save()
await editor?.persist()
terminal.terminateAll()
}