Open
Conversation
Add support for deferring keymap actions to the completion engine when the completion menu is visible. Introduces defer_to_completion field for keymap entries, wraps callbacks to feed the original key sequence to the completion module when visible, updates defaults and README, and adds unit tests and types for the new behavior. This should fix #332
d754d00 to
2b7e33b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds per-keymap control to defer key handling to the active completion UI when the completion menu is visible, addressing intermittent input-window insert-mode keybind issues (Fixes #332).
Changes:
- Introduces
defer_to_completionon keymap entries and updates keymap processing to wrap only those bindings. - Updates default input-window keymaps to defer only the bindings that should yield to completion navigation.
- Updates docs/types and adds unit tests covering the new deferral behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
lua/opencode/keymap.lua |
Implements per-entry completion deferral by wrapping callbacks when defer_to_completion is set. |
lua/opencode/ui/input_window.lua |
Stops globally deferring all input-window keymaps; relies on per-entry deferral instead. |
lua/opencode/config.lua |
Updates default input-window keymaps to mark specific bindings as defer_to_completion = true. |
lua/opencode/types.lua |
Documents the new defer_to_completion field in the keymap entry type. |
tests/unit/keymap_spec.lua |
Adds unit tests verifying direct-callback vs feedkeys behavior when completion is visible. |
README.md |
Documents defer_to_completion and updates example config; adjusts fenced code blocks (currently broken). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,9 +1,12 @@ | |||
| local config = require('opencode.config') | |||
| <selected text> | ||
| ``` | ||
| ``` | ||
| ```` |
Comment on lines
+670
to
+672
| ```` | ||
|
|
||
| ```` |
| :Opencode run new_session "Please help me plan a new feature" agent=plan context.current_file.enabled=false | ||
| :Opencode run "Fix the bug in the current file" model=github-copilot/claude-sonnet-4 | ||
| ``` | ||
| ```` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for deferring keymap actions to the completion engine when the completion menu is visible. Introduces defer_to_completion field for keymap entries, wraps callbacks to feed the original key sequence to the completion module when visible, updates defaults and README, and adds unit tests and types for the new behavior.
This should fix #332