adds schema view and schema generating command

This commit is contained in:
2026-11-03 09:35:41 +01:00
parent cc41decccb
commit 600d4874d2
62 changed files with 4416 additions and 105 deletions
@@ -7,7 +7,7 @@ extension WorkspaceModel {
public func refresh() async {
refreshTick += 1
let editor = editor
async let reread: Void = run([.git, .tree])
async let reread: Void = run([.git, .tree, .schema])
async let active: Void = editor?.reloadActiveFromDisk() ?? ()
_ = await (reread, active)
}
@@ -15,7 +15,7 @@ extension WorkspaceModel {
/// Reacts to a disk change from the watcher: project and git events gather into one debounced refresh.
public func handle(_ event: WatchEvent) async {
switch event {
case .project: scheduleRefresh([.git, .tree, .symbols, .openFiles])
case .project: scheduleRefresh([.git, .tree, .symbols, .openFiles, .schema])
case .git: scheduleRefresh(.git)
case .config: await reloadConfig()
case .cleanCopy: await cleanCopyChanged()
@@ -61,7 +61,8 @@ extension WorkspaceModel {
/// Reads the stores once up front, so a pass that outlives a project switch only touches the old project.
func run(_ scope: RefreshScope) async {
let sourceControl = sourceControl, explorer = explorer, editor = editor
let sourceControl = sourceControl, explorer = explorer, editor = editor, schema = schema
let readsDump = layout.isSchemaViewOpen
let current = generation
if scope.contains(.symbols) {
await services?.symbols.invalidate()
@@ -70,7 +71,8 @@ extension WorkspaceModel {
async let git: Void = scope.contains(.git) ? (sourceControl?.refresh() ?? ()) : ()
async let tree: Void = scope.contains(.tree) ? (explorer?.reload() ?? ()) : ()
async let files: Void = scope.contains(.openFiles) ? (editor?.filesChanged(nil) ?? ()) : ()
_ = await (git, tree, files)
async let dump: Void = scope.contains(.schema) ? (schema?.refresh(readingDump: readsDump) ?? ()) : ()
_ = await (git, tree, files, dump)
}
/// Restarts the countdown on every change, so a burst of writes loads the class list once.