adds schema view and schema generating command
This commit is contained in:
@@ -41,6 +41,8 @@ public struct RefreshScope: OptionSet, Sendable {
|
||||
public static let symbols = RefreshScope(rawValue: 4)
|
||||
/// The open file and every unsaved buffer pick up the disk text; unsaved edits are kept.
|
||||
public static let openFiles = RefreshScope(rawValue: 8)
|
||||
/// The Schema view's command file and dump.
|
||||
public static let schema = RefreshScope(rawValue: 16)
|
||||
}
|
||||
|
||||
/// A list row whose on-screen frame the ⌘→ menu anchors to.
|
||||
@@ -81,6 +83,7 @@ public final class WorkspaceModel {
|
||||
public internal(set) var editor: EditorStore?
|
||||
public internal(set) var terminal: TerminalStore
|
||||
public internal(set) var cleanCopy: CleanCopyStore?
|
||||
public internal(set) var schema: SchemaStore?
|
||||
|
||||
@ObservationIgnored public let app: AppServices
|
||||
@ObservationIgnored public internal(set) var services: WorkspaceServices?
|
||||
@@ -148,6 +151,8 @@ public final class WorkspaceModel {
|
||||
|
||||
case .toggleGit: layout.isGitViewOpen ? closeGitView() : openGitView()
|
||||
case .closeGitView: closeGitView()
|
||||
case .toggleSchemaView: layout.isSchemaViewOpen ? closeSchemaView() : openSchemaView()
|
||||
case .closeSchemaView: closeSchemaView()
|
||||
case let .togglePane(panel): layout.togglePane(panel)
|
||||
case .toggleAutoFit: layout.toggleFluid()
|
||||
case .toggleHidden: layout.toggleHidden()
|
||||
@@ -204,6 +209,27 @@ public final class WorkspaceModel {
|
||||
}
|
||||
case .focusCommitMessage: openGitView()
|
||||
|
||||
case .runSchemaDump:
|
||||
guard let schema else { return }
|
||||
track { await schema.run() }
|
||||
case .generateSchemaCommand:
|
||||
closeSchemaView()
|
||||
passToAgent(SchemaCommandPrompt.text, toast: "Command prompt")
|
||||
case .copySchemaPrompt:
|
||||
app.system.copy(SchemaCommandPrompt.text)
|
||||
toasts.show("Copied prompt")
|
||||
case let .passSchemaTable(name):
|
||||
closeSchemaView()
|
||||
passToAgent("@schema:\(name)", toast: "@schema:\(name)")
|
||||
case let .copySchemaTableName(name):
|
||||
app.system.copy(name)
|
||||
toasts.show("Copied table name", detail: name)
|
||||
case .openSchemaCommandFile:
|
||||
closeSchemaView()
|
||||
open(SchemaPaths.commandFile)
|
||||
case .clearSchemaSelection: schema?.clearSelection()
|
||||
case .clearSchemaSearch: schema?.clearSearch()
|
||||
|
||||
case .copyCleanCopy: copyCleanCopy()
|
||||
|
||||
case .stopReading: readAloud.stop()
|
||||
|
||||
Reference in New Issue
Block a user