updates plak menu item
This commit is contained in:
@@ -41,6 +41,8 @@ public enum ContextAction: Sendable, Equatable {
|
||||
case delete(String, isDirectory: Bool)
|
||||
case copyTerminalSelection(TerminalKind)
|
||||
case pasteIntoTerminal(TerminalKind)
|
||||
/// Reads the pane's selection aloud; the text is fetched when the item runs.
|
||||
case readAloudTerminalSelection(TerminalKind)
|
||||
/// Inserts `/wait-what` with the pane's selection into the agent composer.
|
||||
case waitWhat(TerminalKind)
|
||||
/// Inserts `/bouwen <name>` into the agent composer for an ontwikkeling folder.
|
||||
@@ -48,6 +50,10 @@ public enum ContextAction: Sendable, Equatable {
|
||||
/// Reads a Markdown file's prose aloud.
|
||||
case readAloudFile(String)
|
||||
case readAloudText(String)
|
||||
/// Sends the editor selection to Plak as it is, code and all.
|
||||
case plak(String)
|
||||
/// Sends the pane's selection to Plak; the text is fetched when the item runs.
|
||||
case plakTerminalSelection(TerminalKind)
|
||||
|
||||
/// Destructive items read in amber-deep.
|
||||
public var isDestructive: Bool {
|
||||
@@ -86,7 +92,7 @@ public enum ContextActions {
|
||||
return [
|
||||
.action(.passOnReference(ref, code: hasCode ? code : nil), label: hasCode ? "Pass on selection" : "Pass on reference"),
|
||||
.action(.copyReference(ref), label: "Copy reference"),
|
||||
] + (hasCode ? readAloudSelection(code ?? "", path: reference.path) : []) + showDiff
|
||||
] + (hasCode ? readAloudSelection(code ?? "", path: reference.path) + plak(code ?? "") : []) + showDiff
|
||||
case .projectRoot:
|
||||
return [
|
||||
.action(.newFile(inDirectory: ""), label: "New file"),
|
||||
@@ -114,10 +120,13 @@ public enum ContextActions {
|
||||
.action(.delete(path, isDirectory: true), label: "Delete folder"),
|
||||
]
|
||||
case let .terminal(kind, hasSelection):
|
||||
let readAloud: [ContextMenuEntry] = hasSelection
|
||||
? [.separator, .action(.readAloudTerminalSelection(kind), label: "Read aloud selection"),
|
||||
.separator, .action(.plakTerminalSelection(kind), label: "Plak")] : []
|
||||
let waitWhat: [ContextMenuEntry] = hasSelection && kind == .agent
|
||||
? [.separator, .action(.waitWhat(kind), label: "Wait what?")] : []
|
||||
return (hasSelection ? [.action(.copyTerminalSelection(kind), label: "Copy")] : [])
|
||||
+ [.action(.pasteIntoTerminal(kind), label: "Paste")] + waitWhat
|
||||
+ [.action(.pasteIntoTerminal(kind), label: "Paste")] + readAloud + waitWhat
|
||||
case let .gitRow(path, staged):
|
||||
return fileHead(path) + readAloudFile(path) + [
|
||||
.separator,
|
||||
@@ -145,6 +154,10 @@ public enum ContextActions {
|
||||
return [.separator, .action(.readAloudText(prose.isEmpty ? code : prose), label: "Read aloud selection")]
|
||||
}
|
||||
|
||||
private static func plak(_ code: String) -> [ContextMenuEntry] {
|
||||
[.separator, .action(.plak(code), label: "Plak")]
|
||||
}
|
||||
|
||||
private static func fileHead(_ path: String) -> [ContextMenuEntry] {
|
||||
let name = PathUtils.basename(path)
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user