mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 18:24:21 +01:00
tui: add ability to interrupt running sessions from command palette
This commit is contained in:
@@ -115,15 +115,11 @@ export function Prompt(props: PromptProps) {
|
|||||||
{
|
{
|
||||||
title: "Clear prompt",
|
title: "Clear prompt",
|
||||||
value: "prompt.clear",
|
value: "prompt.clear",
|
||||||
disabled: true,
|
|
||||||
category: "Prompt",
|
category: "Prompt",
|
||||||
|
disabled: true,
|
||||||
onSelect: (dialog) => {
|
onSelect: (dialog) => {
|
||||||
input.extmarks.clear()
|
input.extmarks.clear()
|
||||||
setStore("prompt", {
|
input.clear()
|
||||||
input: "",
|
|
||||||
parts: [],
|
|
||||||
})
|
|
||||||
setStore("extmarkToPartIndex", new Map())
|
|
||||||
dialog.clear()
|
dialog.clear()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -156,16 +152,27 @@ export function Prompt(props: PromptProps) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Interrupt session",
|
||||||
|
value: "session.interrupt",
|
||||||
|
keybind: "session_interrupt",
|
||||||
|
category: "Session",
|
||||||
|
disabled: true,
|
||||||
|
onSelect: (dialog) => {
|
||||||
|
if (!props.sessionID) return
|
||||||
|
sdk.client.session.abort({
|
||||||
|
path: {
|
||||||
|
id: props.sessionID,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
dialog.clear()
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
sdk.event.on(TuiEvent.PromptAppend.type, (evt) => {
|
sdk.event.on(TuiEvent.PromptAppend.type, (evt) => {
|
||||||
setStore(
|
input.insertText(evt.properties.text)
|
||||||
"prompt",
|
|
||||||
produce((draft) => {
|
|
||||||
draft.input += evt.properties.text
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user