MCPcopy Create free account
hub / github.com/anomalyco/opencode / openEditor

Function openEditor

packages/opencode/src/cli/cmd/run/footer.prompt.tsx:815–840  ·  view source on GitHub ↗
(inputValue?: { value?: string })

Source from the content-addressed store, hash-verified

813 }
814
815 const openEditor = async (inputValue?: { value?: string }) => {
816 input.onInputClear()
817 syncDraft()
818 hide()
819
820 const current = clonePrompt(draft)
821 try {
822 const content = await input.onEditorOpen({
823 value: inputValue?.value ?? current.text,
824 })
825 if (content === undefined) {
826 return
827 }
828 const normalized = normalizePromptContent(content)
829
830 restore({
831 text: normalized,
832 parts: realignEditorPromptParts(normalized, current.parts),
833 ...(current.mode ? { mode: current.mode } : {}),
834 ...(current.command ? { command: current.command } : {}),
835 })
836 } catch {
837 restore(current)
838 input.onStatus("failed to open editor")
839 }
840 }
841
842 const select = (item?: PromptOption) => {
843 const next = item ?? options()[menu.selected()]

Callers 2

selectFunction · 0.70
runFunction · 0.70

Calls 6

normalizePromptContentFunction · 0.90
realignEditorPromptPartsFunction · 0.90
syncDraftFunction · 0.85
hideFunction · 0.70
clonePromptFunction · 0.70
restoreFunction · 0.70

Tested by

no test coverage detected