/editor command doesn't work: input never appears in opencode #1396

Closed
opened 2026-02-16 17:30:48 -05:00 by yindo · 8 comments
Owner

Originally created by @JeongJuhyeon on GitHub (Aug 20, 2025).

Originally assigned to: @adamdotdevin on GitHub.

  • Opencode run in Ghostty
  • MacOS 15.5
  1. /editor
  2. opens a blank message in vscode
  3. Write something
  4. Save it
  5. Nothing happens - input does not appear in opencode
Originally created by @JeongJuhyeon on GitHub (Aug 20, 2025). Originally assigned to: @adamdotdevin on GitHub. - Opencode run in Ghostty - MacOS 15.5 1. `/editor` 2. opens a blank message in vscode 3. Write something 4. Save it 5. Nothing happens - input does not appear in opencode
yindo closed this issue 2026-02-16 17:30:48 -05:00
Author
Owner

@OpeOginni commented on GitHub (Aug 23, 2025):

Hey, I found this issue interesting and wanted to check it out, did some reading through the code and debugging.

What seems to work is that making the command to open the file from code tempFile to code --wait tempFile or code -w tempFile, lets opencode wait for you to close the file before the input is returned and then carried into the input of Opencode, rather than using normal code tempFile, where it reads the file immediately its opened and as it is empty when open.

VSCode Docs on CLI Options

I would love to work on a fix for this if I'm allowed, some solutions could be

  • Let users know for vscode in the docs, or any other forks they have to make the export EDITOR to be "code --wait" (not sure if this breaks other systems using the EDITOR like the export command)
  • Other solution seems to be hardcoding the --wait command if the editor being used is not a terminal one or is known to be a VSCode Fork
@OpeOginni commented on GitHub (Aug 23, 2025): Hey, I found this issue interesting and wanted to check it out, did some reading through the code and debugging. What seems to work is that making the command to open the file from `code tempFile` to `code --wait tempFile` or `code -w tempFile`, lets opencode wait for you to close the file before the input is returned and then carried into the input of Opencode, rather than using normal `code tempFile`, where it reads the file immediately its opened and as it is empty when open. [VSCode Docs on CLI Options](https://code.visualstudio.com/docs/configure/command-line#_core-cli-options) I would love to work on a fix for this if I'm allowed, some solutions could be - Let users know for vscode in the docs, or any other forks they have to make the `export EDITOR` to be `"code --wait"` (not sure if this breaks other systems using the EDITOR like the export command) - Other solution seems to be hardcoding the `--wait` command if the editor being used is not a terminal one or is known to be a VSCode Fork
Author
Owner

@rekram1-node commented on GitHub (Aug 23, 2025):

@OpeOginni you are welcome to open pr on this, I would be curious what the common solution here is, originally I was thinking about doing some check to see if --wait was a valid flag on the EDITOR cmd but it was kinda messy

If you wanna do it I would be interested how other cli tools are solving the problem, I think some just force user to add wait flag to their editor cmd but some may try to solve it for them for popular ones

@rekram1-node commented on GitHub (Aug 23, 2025): @OpeOginni you are welcome to open pr on this, I would be curious what the common solution here is, originally I was thinking about doing some check to see if --wait was a valid flag on the EDITOR cmd but it was kinda messy If you wanna do it I would be interested how other cli tools are solving the problem, I think some just force user to add wait flag to their editor cmd but some may try to solve it for them for popular ones
Author
Owner

@JeongJuhyeon commented on GitHub (Aug 23, 2025):

I know Aider has it, though I'm sure there's going to be others as well

@JeongJuhyeon commented on GitHub (Aug 23, 2025): I know Aider has it, though I'm sure there's going to be others as well
Author
Owner

@rekram1-node commented on GitHub (Aug 23, 2025):

@JeongJuhyeon it looks like aider tells you to set the --wait flag yourself:
https://github.com/Aider-AI/aider/blob/32faf82b31c54d6f19c5c3d63bc294f748bd3e72/aider/website/docs/config/editor.md?plain=1#L57

Here is how gemini solves it: https://github.com/google-gemini/gemini-cli/blob/5bba15b0384f184686e511e75da8275adb056d8c/packages/core/src/utils/editor.ts#L118

Ultimately I can't actually tell you the correct answer because this is @adamdotdevin domain but just wanted to mention you should probably explore existing solutions instead of trying to do something novel

@rekram1-node commented on GitHub (Aug 23, 2025): @JeongJuhyeon it looks like aider tells you to set the --wait flag yourself: https://github.com/Aider-AI/aider/blob/32faf82b31c54d6f19c5c3d63bc294f748bd3e72/aider/website/docs/config/editor.md?plain=1#L57 Here is how gemini solves it: https://github.com/google-gemini/gemini-cli/blob/5bba15b0384f184686e511e75da8275adb056d8c/packages/core/src/utils/editor.ts#L118 Ultimately I can't actually tell you the correct answer because this is @adamdotdevin domain but just wanted to mention you should probably explore existing solutions instead of trying to do something novel
Author
Owner

@OpeOginni commented on GitHub (Aug 23, 2025):

@rekram1-node So maybe best solution is to provide this in the Docs, and leave it at that?

@OpeOginni commented on GitHub (Aug 23, 2025): @rekram1-node So maybe best solution is to provide this in the Docs, and leave it at that?
Author
Owner

@rekram1-node commented on GitHub (Aug 23, 2025):

@OpeOginni yeah let's do that for now I like it

@rekram1-node commented on GitHub (Aug 23, 2025): @OpeOginni yeah let's do that for now I like it
Author
Owner

@OpeOginni commented on GitHub (Aug 23, 2025):

Got a PR going 🫡

@OpeOginni commented on GitHub (Aug 23, 2025): Got a PR going 🫡
Author
Owner

@rekram1-node commented on GitHub (Aug 24, 2025):

closing since it is now documented

@rekram1-node commented on GitHub (Aug 24, 2025): closing since it is now documented
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1396